@extra2001/compute-engine
Version:
Symbolic computing and numeric evaluations for JavaScript and Node.js
21 lines (20 loc) • 835 B
TypeScript
/* 0.28.0 */
export declare class CancellationError<T = unknown> extends Error {
cause: unknown;
value: T;
constructor({ message, value, cause, }?: {
message?: string;
value?: T;
cause?: unknown;
});
}
/**
* Executes a generator asynchronously with timeout and abort signal support.
*
* @param gen - The generator to execute.
* @param timeLimitMs - The maximum time (in milliseconds) allowed for execution.
* @param signal - An AbortSignal to cancel execution prematurely.
* @returns The final value produced by the generator.
* @throws CancellationError if the operation is canceled or times out.
*/
export declare function runAsync<T>(gen: Generator<T>, timeLimitMs: number, signal?: AbortSignal): Promise<T>;
export declare function run<T>(gen: Generator<T>, timeLimitMs: number): T;