[whatwg] Global Script proposal
Michael Nordman
michaeln at google.com
Mon Aug 24 15:34:07 PDT 2009
Agreed, blocking semantics are definitely not OK for GlobalScript, this
context-type calls for some form of async importScript functionality. If
order load order matters, apps certainly could defer loading the scripts
until what they depend on have been already loaded already. Where load order
doesn't matter, seems unfortunate to penalize those callers.
Maybe
importScripts(['one.js', 'two.js'], onloadcallback, onerrorcallback);
Immediately initiates in-order loading of the given array of
resources. A second call to importScripts would also begin immediately
as well. So if order matters, put them in the same importScripts call,
and if it doesn't make individual calls.
On Mon, Aug 24, 2009 at 3:15 PM, Drew Wilson <atwilson at google.com> wrote:
> BTW, the WorkerGlobalScope.importScript() API blocks the current thread of
> execution, which is probably not acceptable for code executed from page
> context. So for globalscripts we'll need some way to do async notifications
> when the loading is complete, and report errors. We may also want to have
> some way to automatically enforce ordering (so if I call
> GlobalScript.importScripts() twice in a row, the second script is not
> executed until after the first script is loaded/executed, to deal with
> dependencies between scripts). The alternative is to force applications to
> do their own manual ordering.
> -atw
>
>
> On Mon, Aug 24, 2009 at 11:32 AM, Michael Nordman <michaeln at google.com>wrote:
>
>>
>>>>
>>> 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.
>>
>>
>> I think the plan is to provide an importScript(...) function to
>> globalScripts as is done for workers...
>>
>> http://www.whatwg.org/specs/web-workers/current-work/#importing-scripts-and-libraries
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090824/a4ed3fd9/attachment.htm>
More information about the whatwg
mailing list