export type TaskExecutor = (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void, onCancel: (callback: () => void) => void) => void | Promise; export declare class CancelableTask { private promise; private cancelCallback; private isCanceled; private cancelListeners; constructor(executor: TaskExecutor); cancel(): void; isTaskCanceled(): boolean; onCancel(listener: () => void): void; then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; finally(onfinally?: (() => void) | undefined | null): Promise; [Symbol.asyncIterator](): { next: () => Promise<{ value: T; done: boolean; }>; }; }