mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
25 lines
443 B
Markdown
25 lines
443 B
Markdown
---
|
|
date: 2020-11-11
|
|
id: fe95210e-f59a-45a4-b0ed-f4d3ec981a07
|
|
title: Executing Promises in Parallel (Promises.all)
|
|
---
|
|
|
|
# Description
|
|
|
|
Run promises in parallel. Will throw an
|
|
[exception](20201111092905-javascript_exceptions) if one of the requests
|
|
fail.
|
|
|
|
# Syntax
|
|
|
|
``` javascript
|
|
Promise.all([
|
|
asyncFunc1(),
|
|
asyncFunc2(),
|
|
])
|
|
.then(([result1, result2]) => {
|
|
})
|
|
.catch(err => {
|
|
// Receives first rejection among the Promises
|
|
});
|
|
```
|