Skip to content

Instantly share code, notes, and snippets.

@coltpini
Last active May 5, 2017 22:51
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 coltpini/4792a3ebee7ff75b90fe3049b54b36c9 to your computer and use it in GitHub Desktop.
Save coltpini/4792a3ebee7ff75b90fe3049b54b36c9 to your computer and use it in GitHub Desktop.
Promise.All( [somePromise, anotherPromise, andAFinalPromise] ).then( values => {
//values is an array with the resolves from each of the promises.
}).catch( (err) => {
// if one of the promises rejects, the whole fails.
});
Promise.race( [somePromise, anotherPromise, andAFinalPromise] ).then ( value => {
// value is a single value from the promise that resolved or rejected first.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment