I learn that there are three queue in Event Loop.
- macrotaskqueue
- related with setTimeout, setInterval, event(user gesture) task, event handler, network response etc..
- microtaskqueue
- related with MutationObserver, Object.observe, Promise
- have higher priority than mactotask queue
- main thread work on this queue until it is empty
- rendering will be delayed until this queue is empty
- a task inserted into microtaskqueue in processing microtask will be executed at that iteration ( = microtaskqueue should be empty before going next iteration or rendering)
- animationframequeue
- callback function of requestAnimationFrame() is inserted in this queue
- a task inserted into animationframequeue will be executed at next iteraction(unlike microtaskqueue)
- tasks in this queue will be processed right before rendering
Yes,, But What I want to know is that
- Is microtaskqueue really needed?
- What is practical(useful) example of using microtaskqueue?
- Why the computer guys made this queue? what’s the motivation?
Check please, I need your helps