On Aug 4, 2014, at 15:16 , Juan Ignacio Dopazo <[email protected]> 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
[email protected]
rauschma.de
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss