11export class CancelError extends Error {
22 constructor ( message : string ) {
33 super ( message ) ;
4- this . name = ' CancelError' ;
4+ this . name = " CancelError" ;
55 }
66
77 public get isCancelled ( ) : boolean {
@@ -30,8 +30,8 @@ export class CancelablePromise<T> implements Promise<T> {
3030 executor : (
3131 resolve : ( value : T | PromiseLike < T > ) => void ,
3232 reject : ( reason ?: unknown ) => void ,
33- onCancel : OnCancel
34- ) => void
33+ onCancel : OnCancel ,
34+ ) => void ,
3535 ) {
3636 this . _isResolved = false ;
3737 this . _isRejected = false ;
@@ -64,15 +64,15 @@ export class CancelablePromise<T> implements Promise<T> {
6464 this . cancelHandlers . push ( cancelHandler ) ;
6565 } ;
6666
67- Object . defineProperty ( onCancel , ' isResolved' , {
67+ Object . defineProperty ( onCancel , " isResolved" , {
6868 get : ( ) : boolean => this . _isResolved ,
6969 } ) ;
7070
71- Object . defineProperty ( onCancel , ' isRejected' , {
71+ Object . defineProperty ( onCancel , " isRejected" , {
7272 get : ( ) : boolean => this . _isRejected ,
7373 } ) ;
7474
75- Object . defineProperty ( onCancel , ' isCancelled' , {
75+ Object . defineProperty ( onCancel , " isCancelled" , {
7676 get : ( ) : boolean => this . _isCancelled ,
7777 } ) ;
7878
@@ -86,13 +86,13 @@ export class CancelablePromise<T> implements Promise<T> {
8686
8787 public then < TResult1 = T , TResult2 = never > (
8888 onFulfilled ?: ( ( value : T ) => TResult1 | PromiseLike < TResult1 > ) | null ,
89- onRejected ?: ( ( reason : unknown ) => TResult2 | PromiseLike < TResult2 > ) | null
89+ onRejected ?: ( ( reason : unknown ) => TResult2 | PromiseLike < TResult2 > ) | null ,
9090 ) : Promise < TResult1 | TResult2 > {
9191 return this . promise . then ( onFulfilled , onRejected ) ;
9292 }
9393
9494 public catch < TResult = never > (
95- onRejected ?: ( ( reason : unknown ) => TResult | PromiseLike < TResult > ) | null
95+ onRejected ?: ( ( reason : unknown ) => TResult | PromiseLike < TResult > ) | null ,
9696 ) : Promise < T | TResult > {
9797 return this . promise . catch ( onRejected ) ;
9898 }
@@ -112,15 +112,15 @@ export class CancelablePromise<T> implements Promise<T> {
112112 cancelHandler ( ) ;
113113 }
114114 } catch ( error ) {
115- console . warn ( ' Cancellation threw an error' , error ) ;
115+ console . warn ( " Cancellation threw an error" , error ) ;
116116 return ;
117117 }
118118 }
119119 this . cancelHandlers . length = 0 ;
120- if ( this . _reject ) this . _reject ( new CancelError ( ' Request aborted' ) ) ;
120+ if ( this . _reject ) this . _reject ( new CancelError ( " Request aborted" ) ) ;
121121 }
122122
123123 public get isCancelled ( ) : boolean {
124124 return this . _isCancelled ;
125125 }
126- }
126+ }
0 commit comments