Skip to content

Instantly share code, notes, and snippets.

@ivantsov
Last active October 8, 2017 10:28
Show Gist options
  • Save ivantsov/d389881e389f2ec386fcf7e9492ad5c5 to your computer and use it in GitHub Desktop.
Save ivantsov/d389881e389f2ec386fcf7e9492ad5c5 to your computer and use it in GitHub Desktop.
function foo() {
console.log('foo');
return new Promise(resolve => {
console.log('foo timeout before');
setTimeout(() => {
console.log('foo timeout');
resolve('foo resolved');
}, 1000);
console.log('foo timeout after');
});
}
function bar() {
console.log('bar');
return new Promise(resolve => {
console.log('bar timeout before');
setTimeout(() => {
console.log('bar timeout');
resolve('bar resolved');
}, 3000);
console.log('bar timeout after');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment