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

Tetsuharu OHZEKI saneyuki.snyk at gmail.com
Fri Jun 14 08:00:09 PDT 2013

Thank you.

By the way, if we call `Promise.any()` with some resolved and rejected
promises  and add new fulfillCallback to it, will the fulfillCallback
be invoked once with parameters which are values of all promises
passed to `Promises.any()`?  Or will the fulfillCallback be invoked
with values which are resolved promises only?

like this case:
// p1, p2 are resolved promises. p3 is pending, rejected, or resolved one.
Promise.any(p1, p2, p3).then(function fulfillCallback(){
  // What will this function be passed?


2013/6/14 Tab Atkins Jr. <jackalmage at gmail.com>:
> On Fri, Jun 14, 2013 at 2:25 PM, Tetsuharu OHZEKI
> <saneyuki.snyk at gmail.com> wrote:
>> I have questions about DOM Promise.
>> If we call `Promises.any()` with resolved promises, how does it
>> execute its fulfillCallback?
> The returned promise is immediately fulfilled, so the callback will be
> called in the next tick.
> Remember, the whole point of promises is that you can add new
> callbacks before *or* after the promise is resolved, and it'll work
> either way.
> ~TJ

Tetsuharu OHZEKI
(a.k.a saneyuki_s)

More information about the whatwg mailing list