Clarification for derived promises

Domenic Denicola d at
Tue Jul 14 17:12:40 UTC 2015


On Tue, Jul 14, 2015 at 10:10 AM -0700, "Nicholas C. Zakas" <standards at<mailto:standards at>> wrote:

Hi all,

I'm trying to wrap my head around derived promises and wanted to ask for
a bit of clarification around how `Promise.resolve()` works from a
derived class. Consider this:

class MyPromise extends Promise {}

var p1 = new Promise(function(resolve, reject) {

var p2 = MyPromise.resolve(p1);
p2.then(function(value) {

Am I correct in believing that:

1. `p1` is resolved upon being passed to `MyPromise.resolve()`? I
believe this is what happens in Step 6
2. `p2` is an instance of `MyPromise` that is resolved with a promise
value of 42.


Nicholas C. Zakas

es-discuss mailing list
es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list