Re: Task Queues as a primitive

On Monday, July 1, 2013 at 4:24 PM, Tobie Langel wrote:

> On Monday, July 1, 2013 at 5:21 PM, Marcos Caceres 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 (or does anyone know of related threads else where)? Should we add that to the list of "primitives" we need for the platform?
> Something akin to node.js's process.nextTick would be a good start.


There is also the setImmidate() spec (which seems to have stagnated for a few years!):

https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html

There is a prollyfill: 
https://github.com/NobleJS/setImmediate


Demo:
http://jphpsf.github.io/setImmediate-shim-demo/
> I'm not sure we need the introspection capabilities nor what kind of security problem opening that up might cause.

True. Probably don't need that (or can implement the queues locally as needed without hooking into browser's ones). 
-- 
Marcos Caceres

Received on Monday, 1 July 2013 16:05:15 UTC