Changing dependencies during the load process.

John Barton johnjbarton at google.com
Mon Aug 18 11:13:49 PDT 2014


On Mon, Aug 18, 2014 at 10:43 AM, Ian Hickson <ian at hixie.ch> wrote:
>
>
> On Fri, 15 Aug 2014, John Barton wrote:
> > On Fri, Aug 15, 2014 at 3:41 PM, Ian Hickson <ian at hixie.ch> wrote:
> > > On Fri, 15 Aug 2014, John Barton wrote:
> > > >
> > > > The ES Loader does not maintain a dependency tree. It maintains a
> > > > table of names->modules.
> > >
> > > Maybe I'm misunderstanding the ES6 loader spec. What's the Load Record
> > > [[Dependencies]] list?
> >
> > The dependencies for the Load. Once the load is complete the record is
> > not needed.
>
> How about if the dependencies are changed during the load? For example:
>
>    <script id=a src="a.js" load-policy=when-needed></script>
>

This seems like an unfortunate design choice....


>    <script id=b src="b.js" load-policy=when-needed></script>
>    <script id=c needs="a"> ... </script>
>    <script>
>     // at this point, the script with id=c is blocked waiting for a.js to
>     // load. Let's change its dependencies:
>     document.scripts.c.needs = 'b';
>

...which leads to exotic quirks like this.


>     // now the script needs to trigger b.js to load
>     // a.js' load can be deprioritised (or canceled, if network is at a
>     // premium), and no longer blocks the script from loading
>    </script>
>

System.import already supports dynamic loading with runtime dependency
selection. If you have a problem with it let's discuss that before
redesigning it.

jjb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140818/857162fe/attachment.html>


More information about the es-discuss mailing list