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

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

From: Tetsuharu OHZEKI <saneyuki.snyk@gmail.com>
Date: Fri, 14 Jun 2013 21:25:07 +0900
Message-ID: <CACyPx=m3mJMYpyRzVQ-drt2pSP8c2dtW50ikjNWwVSY3SkZXHg@mail.gmail.com>
To: whatwg@lists.whatwg.org
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)
Received on Friday, 14 June 2013 12:26:03 UTC

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