Loader vs ES6 Classes

Juan Ignacio Dopazo jdopazo at yahoo-inc.com
Mon Aug 4 06:16:37 PDT 2014


In practice we've found that we rarely use the "new Loader(hooks)` option and instead this is more common:

var loader = new Loader();
var loaderFetch = loader.fetch.bind(loader);

loader.fetch = function (loadRecord) {
  // do something
  return loaderFetch(loadRecord);
};

This way we can think of each modification to the loader in isolation and we can use the same code to modify a custom loader instance and to modify the System instance.


-Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140804/15720d5f/attachment.html>


More information about the es-discuss mailing list