UNPKG

680 BTypeScriptView Raw
1/// <reference types="node" />
2import { EventEmitter } from "events";
3export declare class CancellationToken extends EventEmitter {
4 private parentCancelHandler;
5 private _cancelled;
6 readonly cancelled: boolean;
7 private _parent;
8 parent: CancellationToken;
9 constructor(parent?: CancellationToken);
10 cancel(): void;
11 private onCancel(handler);
12 createPromise<R>(callback: (resolve: (thenableOrResult?: R) => void, reject: (error?: Error) => void, onCancel: (callback: () => void) => void) => void): Promise<R>;
13 private removeParentCancelHandler();
14 dispose(): void;
15}
16export declare class CancellationError extends Error {
17 constructor();
18}