This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class CancelableAsyncTask { | |
private do: (...args: any[]) => Promise<any>; | |
private running: boolean; | |
private args: any[]; | |
constructor(doPromise: (...args: any[]) => Promise<any>, ...args: any[]) { | |
this.do = doPromise; | |
this.running = false; | |
this.args = args; | |
} | |
private afterTimeDo( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum State { | |
'pending' = 'pending', | |
'fulfilled' = 'fulfilled', | |
'rejected' = 'rejected' | |
} | |
type CallbackPayload = { | |
onFulfilled: (val: any) => any, | |
onRejected: (reason: any) => any, | |
resolve: PromiseAPlus['resolve'], |