@effectful/cc
Version:
Multi-prompt delimited continuations runtime
12 lines (11 loc) • 875 B
TypeScript
export type CancellationCallback = () => void;
export type CancellationCallbacks = Set<CancellationCallback>;
export declare const CancellationCallbacksSymbol: unique symbol;
export declare function currentCancellationCallbacks(): CancellationCallbacks | undefined;
export declare function addOnCancel(callback: CancellationCallback): void;
export declare function removeOnCancel(callback: CancellationCallback): void;
export declare function withCancellationCallbacks<T>(callbacks: CancellationCallbacks | undefined, body: () => T): T;
export declare function getCancellationCallbacks(target: unknown): CancellationCallbacks | undefined;
export declare function setCancellationCallbacks(target: unknown, callbacks: CancellationCallbacks): void;
export declare function cancel(target: unknown): void;
export declare function installCancelablePromise(PromiseImpl?: any): any;