W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2013

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

From: Tetsuharu OHZEKI <saneyuki.snyk@gmail.com>
Date: Sat, 15 Jun 2013 00:36:50 +0900
Message-ID: <CACyPx=n3Dm26pv5dEOn6QVjPAkYaV=83H0Lmn77eh+Yy53bs7g@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>
2013/6/15 Tab Atkins Jr. <jackalmage@gmail.com>:
> On Fri, Jun 14, 2013 at 5:00 PM, Tetsuharu OHZEKI
> <saneyuki.snyk@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)
Received on Friday, 14 June 2013 15:37:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:22 UTC