File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,13 @@ export interface OnCancel {
21
21
}
22
22
23
23
export class CancelablePromise<T > implements Promise<T > {
24
- readonly [Symbol.toStringTag]!: string;
25
-
26
- private _isResolved: boolean;
27
- private _isRejected: boolean;
28
- private _isCancelled: boolean;
29
- private readonly _cancelHandlers: (() => void)[];
30
- private readonly _promise: Promise<T >;
31
- private _resolve?: (value: T | PromiseLike<T >) => void;
32
- private _reject?: (reason?: any) => void;
24
+ #isResolved: boolean;
25
+ #isRejected: boolean;
26
+ #isCancelled: boolean;
27
+ readonly #cancelHandlers: (() => void)[];
28
+ readonly #promise: Promise<T >;
29
+ #resolve?: (value: T | PromiseLike<T >) => void;
30
+ #reject?: (reason?: any) => void;
33
31
34
32
constructor(
35
33
executor: (
@@ -85,6 +83,10 @@ export class CancelablePromise<T> implements Promise<T> {
85
83
});
86
84
}
87
85
86
+ get [Symbol.toStringTag]() {
87
+ return "Cancellable Promise";
88
+ }
89
+
88
90
public then<TResult1 = T, TResult2 = never>(
89
91
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1 >) | null,
90
92
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2 >) | null
You can’t perform that action at this time.
0 commit comments