Skip to content

Instantly share code, notes, and snippets.

@petvas
Last active February 26, 2016 16:15
Show Gist options
  • Save petvas/6e954b5204daeded88af to your computer and use it in GitHub Desktop.
Save petvas/6e954b5204daeded88af to your computer and use it in GitHub Desktop.
Promises All Paralel
/**
* Promises All
*/
(function () {
var promises = [
Promise.resolve('1st'),
Promise.resolve('2nd'),
Promise.resolve('...'),
Promise.resolve('n'),
];
/**
* Promise all wait for all promises get resolve and return with array, catch the 1st reject
*/
Promise.all(promises).then(console.log.bind(console)).catch(console.log.bind(console));
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment