[whatwg] Script preloading

Jake Archibald jaffathecake at gmail.com
Wed Jul 10 02:32:39 PDT 2013


On 9 July 2013 22:31, Garrett Smith <dhtmlkitchen at gmail.com> wrote:

> On 7/9/13, Ian Hickson <ian at hixie.ch> wrote:<script id="jquery"
> src="jquery.js" async></script>
> >      <script id="shims" src="shims.js" async></script>
> >      <script dependencies="shims jquery" src="myscript.js"
> async></script>
> >
>
> Why limit "depends" to be used by only scripts to refer only to other
> scripts?
>
> If you put <link depends=idref> on style then stylesheet evaluation
> could be deferred, too.
>

I like this idea and want to start a family with it.

>    This would then cause the scripts to execute, first jquery.js and
> >    shims.js (in any order), and then myscript.js. If any hadn't finished
> >    downloading yet, it would first wait for that to finish.
> >
> >    (We could make markNeeded() return a promise, too.)
> >
> Or use a callback. Blocking on resource loading is bad.
>

Promises don't block. New APIs that want callbacks for async
success/failure should use Promises.



More information about the whatwg mailing list