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

Tetsuharu OHZEKI saneyuki.snyk at gmail.com
Fri Jun 14 05:25:07 PDT 2013


Hello,

I have questions about DOM Promise.

If we call `Promises.any()` with resolved promises, how does it
execute its fulfillCallback?

The following is sample code:
```
var p1 = new Promise(function(r){
  r = r.resolve("value1");
});
var p2 = new Promise(function(r){
  r = r.resolve("value2");
});
var p3 = new Promise(function(r){
  r = r.resolve("value3");
});

// Pass some promises which have been resolved already.
Promsie.any(p1, p2, p3).then(function(){
  // how will the browser call this function?
});

```

Thank you.

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


More information about the whatwg mailing list