Created
March 19, 2019 15:16
-
-
Save brownsmith/c7d372625667cdcc92b715b0f5127ece to your computer and use it in GitHub Desktop.
Promise stuff
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 hello(resolve) { | |
// do whatever | |
resolve(); | |
} | |
function hello2(resolve) { | |
// do whatever | |
resolve(); | |
} | |
function helloLast() { | |
console.log('all done'); | |
} | |
function runthisfirst() { | |
return new Promise(function(resolve, reject) { | |
hello(resolve); | |
hello2(resolve); | |
}); | |
} | |
runthisfirst().then(() => { | |
helloLast(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment