Last active
March 27, 2017 02:34
-
-
Save toddzebert/996e297c1c081d19378eaf5f29dc75bb to your computer and use it in GitHub Desktop.
"simulates" an async function with Promises
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
// requires https://gist.github.com/toddzebert/b4465de41b0f8d317d7a685604983c36 | |
var simAsync = function(fulfillment, rejection) { | |
return new Promise( (resolve, reject) => { | |
const delay = randInt(400, 200); | |
setTimeout(() => { resolve(fulfillment()); }, delay); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment