Joins two or more promises and returns only when all the specified promises have completed or been rejected.
Syntax
Promise.all(func1, func2 [,funcN])
Parameters
func1
Required. A function that returns a promise.
func2
Required. A function that returns a promise.
funcN
Optional. One or more functions that return a promise.
Remarks
The result returned is an array of values returned by the completed promises. If one of the joined promises is rejected, Promise.all immediately returns with the reason for the rejected promise (all other returns values are discarded).
Example
In this code, the first call to timeout returns after 5000ms. The completion handler calls Promise.all, which returns only when both calls to timeout are completed or rejected.
function timeout(duration) {
return new Promise(function(resolve, reject) {
setTimeout(resolve, duration);
});
}
var p = timeout(5000).then(() => {
return Promise.all([timeout(100), timeout(200)]);
})
Requirements
Supported in Microsoft Edge (Edge browser). Also supported in Store apps (Microsoft Edge on Windows 10). See Version Information.
Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.

