On Mon, 18 Aug 2014, John Barton wrote: > > > > (For example, a graphical game might need some sprite assets to be > > loaded before it can start up. So its <script> might be marked as > > depending on an <img> element that loads that image. Or the script > > contents might have an import statement that refers to that image.) > > Supporting this case seems straight-forward and can be done entirely by > the browser Loader implementation using hooks.
That is my hope, yes. > The reverse case, where a img depends on a script, is not a use case. Why not? What if the image has an onmouseover handler that calls an API function defined in a module, for instance? > > > > Or indeed even when scripting is enabled, how would you use it to > > > > mark one non-loaded script as dependent on another non-loaded > > > > script such that when you later ask for the former, the latter > > > > loads automatically? > > > > > > import './latter'; > > > > > > It's a solved problem for scripts. > > > > The key part of my question was "non-loaded". The "import" bit is in > > the script. The script isn't loaded yet, so we can't rely on it. > > <script> > System.import('./former').then((former) => { > // do stuff with former, knowing './former' imported './latter'. > }); > </script> This results in multiple RTTs. Also, this doesn't wait until former is needed before loading it. > Here we are expressing the dependency of the HTML file on the non-loaded > file './former' and it depends on the non-loaded file './latter'. But you don't know that it depends on ./latter until you've fetched ./former, by which time it's too late. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.' _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss