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

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@gmail.com>:
> 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



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

Received on Friday, 14 June 2013 15:00:53 UTC