-
Notifications
You must be signed in to change notification settings - Fork 576
Overriding System Loader behavior
ry edited this page Dec 11, 2014
·
4 revisions
To supply new functions for System functions, extend TraceurLoader and override the functions normalize, locate, fetch, translate or instantiate. The first three are supported and we'll fix any bugs against them. The translate and instantiate are called but probably don't do what the standard expects.
For example, you might do something like
import {webLoader} from './webLoader';
class MyLoader extends TraceurLoader {
constructor() {
super(webLoader, window.location.href);
}
normalize(name) {
// bah I am normal!
return name;
}
}
System = new MyLoader();See also http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders