Difference between microtask and macrotask within an event loop context

I’ve just finished reading the Promises/A+ specification and stumbled upon the terms microtask and macrotask: see http://promisesaplus.com/#notes

I’ve never heard of these terms before, and now I’m curious what the difference could be?

I’ve already tried to find some information on the web, but all I’ve found is this post from the w3.org Archives (which does not explain the difference to me): http://lists.w3.org/Archives/Public/public-nextweb/2013Jul/0018.html

Additionally, I’ve found an npm module called “macrotask”: https://www.npmjs.org/package/macrotask
Again, it is not clarified what the difference exactly is.

All I know is, that it has something to do with the event loop, as described in https://html.spec.whatwg.org/multipage/webappapis.html#task-queue
and https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint

I know I should theoretically be able to extract the differences myself, given this WHATWG specification. But I’m sure that others could benefit as well from a short explanation given by an expert.

5 Answers
5

Leave a Comment