/** * A `CancelToken` is an object that can be used to request cancellation of an operation. * * @class * @param {Function} executor The executor function. */ export declare class Cancel { readonly message?: string | undefined; constructor(message?: string | undefined); toString(): string; } export declare type Canceler = (message?: string) => void; export interface CancelTokenSource { token: CancelToken; cancel: Canceler; } export declare class CancelToken { promise: Promise; _listeners?: any[]; reason?: Cancel; static isCancel(obj: any): obj is Cancel; constructor(executor: (callback: Canceler) => void); /** * Throws a `Cancel` if cancellation has been requested. */ throwIfRequested(): void; /** * Subscribe to the cancel signal */ subscribe(listener: (reason: Cancel) => void): void; /** * Unsubscribe from the cancel signal */ unsubscribe(listener: (reason: Cancel) => void): void; /** * Returns an object that contains a new `CancelToken` and a function that, when called, * cancels the `CancelToken`. */ static source(): CancelTokenSource; }