CancellationToken.d.ts 679 B

12345678910111213141516171819
  1. /// <reference types="node" />
  2. import { EventEmitter } from "events";
  3. export 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. }
  16. export declare class CancellationError extends Error {
  17. constructor();
  18. }