MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / constructor

Method constructor

src/effected.ts:373–385  ·  view source on GitHub ↗
(fn: () => Iterator<E, R, unknown>, magicWords?: string)

Source from the content-addressed store, hash-verified

371 declare public readonly runAsyncUnsafe: () => Promise<ExtractDefaultTerminateType<E> | R>;
372
373 private constructor(fn: () => Iterator<E, R, unknown>, magicWords?: string) {
374 if (magicWords !== "Yes, I’m sure I want to call the constructor of Effected directly.")
375 logger.warn(
376 "You should not call the constructor of `Effected` directly. Use `effected` instead.",
377 );
378
379 this[Symbol.iterator] = fn;
380
381 this.runSync = (() => runSync(this as never)) as never;
382 this.runAsync = (() => runAsync(this as never)) as never;
383 this.runSyncUnsafe = () => runSync(this as never);
384 this.runAsyncUnsafe = () => runAsync(this as never);
385 }
386
387 /**
388 * Create an {@link Effected} instance that just returns the value.

Callers

nothing calls this directly

Calls 2

runSyncFunction · 0.85
runAsyncFunction · 0.85

Tested by

no test coverage detected