Created
June 12, 2019 02:30
-
-
Save tai2/4d0df325ec8d2938fe0918317993256d to your computer and use it in GitHub Desktop.
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 Deferred<T> { | |
promise: Promise<T> | |
resolve: (value?: T | PromiseLike<T>) => void | |
reject: (reason?: any) => void | |
constructor() { | |
this.resolve = () => {} | |
this.reject = () => {} | |
this.promise = new Promise<T>((resolve, reject) => { | |
this.reject = reject; | |
this.resolve = resolve; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment