Last active
September 1, 2020 03:26
-
-
Save cowlicks/b759cde8a79a7a480f086f75c71d91af to your computer and use it in GitHub Desktop.
A concise implementation of a 'Deferred' object factory in javascript
This file contains hidden or 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() { | |
const o = {}, | |
p = new Promise((resolve, reject) => Object.assign(o, {resolve, reject})); | |
return Object.assign(p, o); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment