[whatwg] Global Script proposal

Patrick Mueller pmuellr at muellerware.org
Mon Aug 24 06:05:47 PDT 2009

Patrick Mueller wrote:
> Michael Nordman wrote:
>> I'm confused about the manual loading of the script into the context? The
>> original proposal called for providing a script url when 
>> creating/connecting
>> to an instance of a global-script... in which case each client page
>> expresses something more like...
>> globalScript = new GlobalScript(scriptUrl);
>> globalScript.onload = myFunctionThatGetsCalledWhenTheScriptIsLoaded;
>> // some time later onload fires, if the script was already loaded, its
>> called on the next time thru the message loop
> Here's what Dmitry Titov proposed on 2009/08/17:
>    var context = new GlobalScript();
>    context.onload = function () {...}
>    context.onerror = function () {...}
>    context.load('foo.js');

Dmitry had a later note which combined creation of the context and 
loading of the script.  But I suspect one thing people will want to do, 
in development anyway, is load multiple scripts into a context - like 
you can in workers.  Which would mean we'd still need a function to load 
a script, or the only way to load a script would be by also creating a 
new context - which is much like the serverJS module concept.

Patrick Mueller - http://muellerware.org

More information about the whatwg mailing list