[whatwg] How works Promise.any() if it was called with resolved promises?

Tetsuharu OHZEKI saneyuki.snyk at gmail.com
Fri Jun 14 08:36:50 PDT 2013


2013/6/15 Tab Atkins Jr. <jackalmage at gmail.com>:
> On Fri, Jun 14, 2013 at 5:00 PM, Tetsuharu OHZEKI
> <saneyuki.snyk at gmail.com> wrote:
> If you check out the spec, Promise.any() runs down its list of
> arguments in order, giving them the ability to resolve the returned
> promise.  So if several of them are already resolved, the first one in
> argument order is what gets used - the rest of them *try* to fulfill
> the promise, but it's already been resolved, so it doesn't do
> anything.

Oh, thank you!
I confused the spec description... I get the point by your comment.

So the following is confirmation:
* `Promise.any()`'s fulfillCallback is called once when the one in
argument order has been resolved.
* If the first one in argument order has been resolved, its state will
decide the state of the promise returned from `Promise.any()`.
* Values of resolved promises in argument order are passed to
`Promise.any()`'s fulfillCallback.

Is this all right ?


--
Tetsuharu OHZEKI
(a.k.a saneyuki_s)



More information about the whatwg mailing list