Last active
February 26, 2016 16:15
-
-
Save petvas/6e954b5204daeded88af to your computer and use it in GitHub Desktop.
Promises All Paralel
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
/** | |
* 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