Promise.allSettled()

Esta tradução está incompleta. Ajude a traduzir este artigo em inglês

O método Promise.allSettled() retorna uma promessa que é resolvida após todas as promessas dadas serem resolvidas ou rejeitadas, com um array de objetos que descrevem o resultado de cada promessa.

Sintaxe

promise.allSettled(iterable);

Parameters

iterable
An iterable object, such as an Array, in which each member is a Promise.

Return value

A pending Promise that will be asynchronously fulfilled once every promise in the specified collection of promises has completed, either by successfully being fulfilled or by being rejected. At that time, the returned promise's handler is passed as input an array containing the outcome of each promise in the original set of promises.

For each outcome object, a status string is present. If the status is fulfilled, then a value is present. If the status is rejected, then a reason is present. The value (or reason) reflects what value each promise was fulfilled (or rejected) with.

Specifications

Specification Status Comment
Promise.allSettled() (TC39 Stage 4 Draft) Padrão em tempo real

Browser compatibility

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
allSettled()Chrome Full support 76Edge Full support 79Firefox Full support 71IE No support NoOpera Full support 63Safari Full support 13WebView Android Full support 76Chrome Android Full support 76Firefox Android No support NoOpera Android Full support 54Safari iOS Full support 13Samsung Internet Android No support Nonodejs Full support 12.9.0

Legend

Full support  
Full support
No support  
No support

See also