Skip to content

Instantly share code, notes, and snippets.

@brownsmith
Created March 19, 2019 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brownsmith/c7d372625667cdcc92b715b0f5127ece to your computer and use it in GitHub Desktop.
Save brownsmith/c7d372625667cdcc92b715b0f5127ece to your computer and use it in GitHub Desktop.
Promise stuff
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