1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export default class PCancelable<T> implements PromiseLike<T> {
|
8 | private _pending;
|
9 | private _canceled;
|
10 | private _promise;
|
11 | private _cancel?;
|
12 | private _reject;
|
13 | constructor(executor: (onCancel: (cancelHandler: () => void) => void, resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void);
|
14 | then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onRejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
15 | catch<TResult>(onRejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
16 | cancel(): void;
|
17 | }
|