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

Function constructHandledEffect

src/effected.ts:2780–2804  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2778 };
2779
2780 const constructHandledEffect = ():
2781 | { _effectSync: true; value?: unknown }
2782 | {
2783 _effectAsync: true;
2784 onComplete: (callback: (...args: [] | [R]) => void) => void;
2785 } => {
2786 // For synchronous effects
2787 if (resumed || context.terminated)
2788 return {
2789 _effectSync: true,
2790 ...(Object.is(resumed, "with-value") ? { value: resumedValue! }
2791 : Object.is(context.terminated, "with-value") ? { value: context.terminatedValue! }
2792 : {}),
2793 };
2794 // For asynchronous effects
2795 const handledEffect: ReturnType<typeof constructHandledEffect> = {
2796 _effectAsync: true,
2797 onComplete: (callback) => {
2798 onComplete = callback;
2799 },
2800 };
2801 if ((effect as any).interruptable)
2802 (handledEffect as any).interruptable = (effect as any).interruptable;
2803 return handledEffect;
2804 };
2805
2806 const handlerResult = handler(
2807 {

Callers 1

handleEffectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected