On Thursday, May 29, 2014 4:34 PM, Ian Hickson <[email protected]> wrote:


The contexts in which I am interested about this kind of thing
 is:


- some people want to predeclare a bunch of scripts and their 
>   dependencies, without actually downloading any of them ahead of time, 
>   and then later, when they're needed, have the entire tree downloaded 
>   all at once. 

At the moment we're doing this by running static analysis tools on the ES6 
modules and using the information from the dependency tree to know how to 
download all of them at once.
- sometimes, even a file that is not downloaded immediately upon being 
>   referenced by another file might still want to be precached, so that 
>   when it _is_ needed, it's already locally available

The Loader object is actually a dictionary, so it acts as its own cache. You 
can call loader.fetch() yourself without
 the module being executed in order to cache it.

On Thu, 29 May 2014, Juan Ignacio Dopazo wrote:

> The Loader will know to wait for those dependencies.
>
>
>
>I'm having difficulty understanding the spec for the instantiate hook. 
>Does it get called before the fetch hook? Is there some way to dynamically 
>add dependencies later?
The lifecycle of a module request is normalize -> locate -> fetch -> translate 
-> instantiate. Instantiate doesn't actually execute anything until all of the 
dependencies have gone through the same 5 steps.





Juan
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to