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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 14 Jun 2013 16:32:05 +0200
Message-ID: <CAAWBYDBH6Apj_AJ6QQRq0Ws=NOMgz1YaJ42r9096R+q2YOC4wg@mail.gmail.com>
To: Tetsuharu OHZEKI <saneyuki.snyk@gmail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Fri, Jun 14, 2013 at 2:25 PM, Tetsuharu OHZEKI
<saneyuki.snyk@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
Received on Friday, 14 June 2013 14:32:54 UTC

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