Integrating the Webs' dependency systems

Juan Ignacio Dopazo jdopazo at
Thu May 29 08:15:56 PDT 2014

>On Wednesday, May 28, 2014 7:27 PM, Ian Hickson <ian at> wrote:
One thing I don't see in the hooks above is anything to do with actually 
>processing dependencies. How would I (at the spec level) tell the ES6 
>module system that it should not evaluate a particular module until some 
>non-script resource, e.g. a style sheet, is available?
When you create a dynamic module in the instantiate hook you can specify a list of dependencies like this:

System.instantiate = function (loadRecord) {
  return {
    deps: ['some', 'list', 'of', 'dependencies'],
    execute: function () {
      // return a new Module instance

The Loader will know to wait for those dependencies.

One thing about this is it seems very script-centric. It would be weird if 
>every time there was a <link rel=stylesheet> in the document, we 
>implicitly went through an ES6 module's instantiate hook just to fire up 
>the style sheet. Is there some way we can make this more generic?

Yes, the System loader would be an API for imperatively loading stuff from a script. The Loader hooks are the way of exposing to the JS environment how the browser loads stuff.

This is interesting because users could actually modify the System loader. For example, they could set it up to load modules conditionally according to the browser's features. It could also be interesting to leave that door open for non-script imports also being subject to user rules.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list