Re: Executing script-inserted external scripts in insertion order

On 10/18/10 1:44 AM, Adam Barth wrote:
> My first thought would be to keep a list of the ids of all scripts
> executed by the document (adding the ID of each script immediately
> before executing the scripts).  When you think you might want to
> execute a waitFor script, you first check this list to see if the
> prerequisites have executed.  If so, then you execute.  If not, you
> append it to a list of scripts-waiting-for-prerequisites.  Whenever
> you add an ID to the scripts-waiting-for-prerequisites list, you check
> to see if you can now execute any of the scripts in the
> scripts-waiting-for-prerequisites list.  If so, you execute the
> scripts with fulfilled prerequisites in list-order.  (There are some
> details about insertion points which would need to be nailed down, but
> you get the idea.)

This might work.... Still seems overcomplicated to handle the use case 
at hand, and we have no indication that anyone has other use cases for 
this at the moment...

>> Presumably in combination with @async?
>
> Yes.  Maybe it would be useful for waitFor to imply async?

I suppose it could be used on non-async scripts to wait on scripts that 
didn't block the parser...

-Boris

Received on Tuesday, 19 October 2010 02:01:03 UTC