W3C home > Mailing lists > Public > public-nextweb@w3.org > July 2013

Re: Task Queues as a primitive

From: Marcos Caceres <w3c@marcosc.com>
Date: Mon, 1 Jul 2013 17:12:20 +0100
To: Fran├žois REMY <francois.remy.dev@outlook.com>
Cc: public-nextweb@w3.org, Domenic Denicola <domenic@domenicdenicola.com>
Message-ID: <128F4C2122B9457484D21279B17932E8@marcosc.com>
(Cc'd Domenic, as he has been pushing this for a while...)

On Monday, July 1, 2013 at 4:37 PM, Fran├žois REMY wrote:

> > The HTML spec speaks a lot about task queues [1]
> > and "spin the event loop" [2], but there are only
> > limited ways for devs to hook into those today.
> >  
> > Would be nice if there was some primitive that
> > allowed JS developers to hook into the loop without
> > relying on hacks like setTimeout and MutationObserver.
> >  
> > It would also be nice to see what is in those task queues
> > (ordering, etc) and in which order the task queues are
> > processed.
> >  
> > Thoughts?
> Browser will probably never let you look at what they're going to do next,  
> because that would reveal much of their internal behavior, may be decided in  
> function of what you're doing and how much time it took, and may change  
> between releases (and therefore causing bugs if you act based on this  
> information).

> However, it seems it's already possible to build a JS-based priority queue  
> by using the setImmediate()

Note that this is IE only right now. But good to know at least someone here is using IE and watching what is going on in Microsoft land :)
> hook and a custom Scheduler interface, as  
> demonstrated in WinJS 2.0 [1]. Basically, they're using priority bins to  
> influence the order of JS-based async tasks by managing them in a scheduler  
> that will act as a gateway from the native event loop to the JS waiting  
> tasks.

Neat. Great to hear there is a proof of concept already running based on setImmidiate.    
> The source code of WinJS is available but I've not downloaded the 2.0  
> preview version so I can't give more insight about it (and, in particular,  
> if they used any other API than setImmediate to hook into the event queue).

Would be interesting to see. Can we get someone form Microsoft to join this list?  

Some related bugs (promises and ES related):

If we want this in Gecko:

If we want this in Webkit:  

Kind regards,
Received on Monday, 1 July 2013 16:12:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:05:54 UTC