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

Method resume

src/effected.ts:785–799  ·  view source on GitHub ↗
(effect: any, handler: (...payloads: unknown[]) => unknown)

Source from the content-addressed store, hash-verified

783 : never,
784 ): Effected<ExcludeEffect<E, Effect<Name>> | F, R>;
785 resume(effect: any, handler: (...payloads: unknown[]) => unknown) {
786 return this.handle(effect, (({ resume }: any, ...payloads: unknown[]) => {
787 const it = handler(...payloads);
788 if (!(it instanceof Effected) && !isGenerator(it)) return resume(it);
789 const iterator = it[Symbol.iterator]();
790 return {
791 _effectedIterator: true,
792 next: (...args: [] | [unknown]) => {
793 const result = iterator.next(...args);
794 if (result.done) return { done: true, value: resume(result.value) };
795 return result;
796 },
797 };
798 }) as never);
799 }
800
801 /**
802 * Terminate an effect with the return value of the handler.

Callers 2

provideMethod · 0.95
provideByMethod · 0.95

Calls 3

handleMethod · 0.95
isGeneratorFunction · 0.85
resumeFunction · 0.85

Tested by

no test coverage detected