mirror of
https://github.com/Fechin/reference.git
synced 2026-11-20 21:23:11 +03:00
Merge pull request #679 from ajiharan-cerexio/js-clone
promise.allSettled function added
This commit is contained in:
1 file changed
+16
@@ -1299,6 +1299,22 @@ Promise.all([promise1, promise2]).then((res) => {
|
||||
});
|
||||
```
|
||||
|
||||
### Promise.allSettled()
|
||||
|
||||
```javascript
|
||||
const promise1 = Promise.resolve(3);
|
||||
const promise2 = new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(2);
|
||||
}, 100);
|
||||
});
|
||||
|
||||
Promise.allSettled([promise1, promise2]).then((res) => {
|
||||
console.log(res[0].status);
|
||||
console.log(res[1].status);
|
||||
});
|
||||
```
|
||||
|
||||
### Avoiding nested Promise and .then()
|
||||
|
||||
```javascript
|
||||
|
||||
Reference in new issue
Block a user