On Aug 4, 2014, at 15:16 , Juan Ignacio Dopazo <jdop...@yahoo-inc.com> wrote:

> 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);
> };



Why not like this then? You’d need (a compiler for) ES6, though.

```js
class MyLoader extends Loader {
    fetch(loadRecord) {
        // do something
        return super(loadRecord);
    }
}
let loader = new MyLoader();
```

-- 
Dr. Axel Rauschmayer
a...@rauschma.de
rauschma.de



_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to