The Promise.any()
method accepts an array (or any other iterable) of promises as a parameter. It returns a Promise
object that is fulfilled with the value of the first input promise to fulfill:
Promise
object is fulfilled with that value.Promise
object is rejected with an AggregateError
which has an errors
property containing an array of all rejection reasons.Promise.any()
can be used to race multiple promises against each other and find the first promise to be fulfilled.
Please note that at the moment, the Promise.any() method is only implemented in Firefox Nightly. Make sure to use a polyfill in your application to make it work across browsers.
...Is 42 a Hitchhikers Guide to the Galaxy reference? π
...Is 42 a Hitchhikers Guide to the Galaxy reference? π
Possibly! I can neither confirm nor deny. π