Skip to content

Instantly share code, notes, and snippets.

@juandopazo
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juandopazo/dfc6c067f1442fa8fa23 to your computer and use it in GitHub Desktop.
Save juandopazo/dfc6c067f1442fa8fa23 to your computer and use it in GitHub Desktop.
Loader hooks API surface
interface LoadRequest {
name: string;
address?: string;
source?: string;
metadata: Object;
}
interface Eventual<T> = T | Promise<T>;
interface ModuleInstantiator {
deps: string[];
execute(): Reflect.Module;
}
interface LoaderHooks {
normalize(string): Eventual<string>;
locate(LoadRequest): Eventual<string>;
fetch(LoadRequest): Eventual<string>;
translate(LoadRequest): Eventual<string>;
instantiate(LoadRequest): ModuleInstantiator;
}
interface SystemClass extends Loader, LoaderHooks {
}
interface GlobalSystem {
System: SystemClass;
}
Window implements GlobalSystem;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment