AP2 bugs

Domenic Denicola domenic at domenicdenicola.com
Sat Aug 31 14:17:57 PDT 2013


Microtasks are unfortunately not defined anywhere, but Anne has [a bug open on HTML5][1] to do so.

Well, OK, looking at the spec, it kind of defines [something called a microtask][2], but it's deeply coupled with the `MutationObserver` objects at the moment.
 
[1]: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22296
[2]: http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#perform-a-microtask-checkpoint

> -----Original Message-----
> From: Tab Atkins Jr. [mailto:jackalmage at gmail.com]
> Sent: Saturday, August 31, 2013 17:14
> To: Nathan Wall
> Cc: es-discuss at mozilla.org; Domenic Denicola
> Subject: Re: AP2 bugs
> 
> On Sat, Aug 31, 2013 at 9:03 AM, Nathan Wall <nathan.wall at live.com> wrote:
> > Am I correct to understand that "queue a microtask" means that the task
> should be run asynchronously?  For this, I am currently using a function called
> `defer(f)` which is just a wrapper around `setTimeout(f, 0)`.
> 
> Yes, but setTimeout is "more asynchronous" than a microtask.
> Microtasks are defined by HTML I think?  Basically, a microtask is run at the
> end of the current script stack, just before yielding control to the browser.
> 
> Using setTimeout shouldn't be incorrect, but it will be slower than intended.
> 
> ~TJ



More information about the es-discuss mailing list