System as a SystemLoader class

Guy Bedford guybedford at gmail.com
Mon Jul 14 10:39:01 PDT 2014


Currently if I want to subclass the System loader I need to do something
like -

var newLoader = new Loader(System);
newLoader.fetch = function() {
  // ...
}

Effectively we're monkey-patching, which isn't pretty.

It would be nice to be able to do:

class newLoader extends System.constructor {
  constructor(loaderConfig) {
    this.baseURL = loaderConfig.baseURL;
    // ...
  }
  fetch: function() {
    super.fetch
  }
}

In order to allow this, we would need to first define a SystemLoader class,
and make System an instance of it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140714/2b002d7d/attachment.html>


More information about the es-discuss mailing list