Tab Atkins Jr. (2013-08-31T21:13:51.000Z)
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
domenic at domenicdenicola.com (2013-09-08T00:35:44.944Z)
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.