Closed caridy closed 2 years ago
cc @nicolo-ribaudo
Notes from SES meeting today. Please consult the recording for context.
type handler = {
// referrer?: string,
importHook?: (specifier: string) => Module,
}
Module(source, handler)
Module[[Context]][[ImportHook]] provides the default importHook
In web page https://example.com:
<html>
<script type="module">
new Module(`
import 'foo.js'; // https://example.com/foo.js on the web
`, {
importHook: undefined // use default
});
</script>
@nicolo-ribaudo thanks for the review... the changes are in.
@kriskowal now that this is merged, can you update the explainers and examples?
Absolutely. Forthcoming.
This PR removes the
referral
in favor of usinghandler
argument, which is similar to a proxy handler, and can contain multiple hooks (only 2 for now, importHook and importMetaHook - we probably need better names).This PR also implements the concepts of the default hooks, so the handler argument becomes optional.
This PR also covers https://github.com/tc39/proposal-compartments/issues/75