[whatwg] How works Promise.any() if it was called with resolved promises?
Tab Atkins Jr.
jackalmage at gmail.com
Fri Jun 14 08:51:45 PDT 2013
On Fri, Jun 14, 2013 at 5:36 PM, Tetsuharu OHZEKI
<saneyuki.snyk at gmail.com> wrote:
> 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
> 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.
Promise.any() only passes the *first* argument's fulfill value to its
callback, not all of them (even if it was called with several
Otherwise, you're right.
More information about the whatwg