>     throw() { throw new CancelError() }
>

This should be `throwIfRequested` I think, e.g.

    throwIfRequested() {
      if (this._requested)
        throw new CancelError();
      }
    }


> What would be the recommended way of keeping the internal state
> private? With a WeakMap?
>

Spec-defined objects can have "internal slots" (essentially private
fields), which can be simulated with WeakMaps.  Although a polyfill would
most likely just use underscored names.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to