Subclassing ES6 objects with ES5 syntax.

C. Scott Ananian ecmascript at
Wed Apr 29 19:02:35 UTC 2015

  constructor(x) {
    Object.defineProperties(this, { then: { value: this.then }});
    if (this.constructor==DefensivePromise && this.then ===
DefensivePromise.prototype.then) {
Getting closer, I hope!

> I also like the point implicit in your attack that I also need the
> invariant that
> DefensivePromise.resolve(anything).then(anycallback)
> should all callback at most once.

I believe this is already taken care of by the ES6 spec once you make it
into `NewPromiseCapability`.  At least I wrote tests for `es6-shim` once
upon a time purporting to show this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list