Created
November 6, 2020 13:11
-
-
Save aeinbu/59bf1e946e6de3d299e3d0bdd6cb3f30 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
function Deferred() { | |
this.resolve = null; | |
this.reject = null; | |
this.promise = new Promise((resolve, reject) => { | |
this.resolve = resolve; | |
this.reject = reject; | |
}); | |
} | |
var d = new Deferred(); | |
d.promise.then(x => { | |
console.log("ok"); | |
}).catch(x => { | |
console.log("failed"); | |
}); | |
console.log("start"); | |
d.resolve(); | |
//d.reject(); | |
console.log("end"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment