Event Loop Phases
Each phase of the Event Loop is responsible for different types of operations. There are such phases:
- Timers
- I/O callbacks
- setImmediate
- Close callbacks
Each of these phases have their separate Callback Queue.
It starts by looking at the timer queue and checks if there are any functions that are available to execute i.e., functions for timers that have completed. It then moves on to I/O callback. And after that, it checks for any setImmediate functions. In the end, it checks for Close Callbacks i.e., callbacks when a file or DB connection is closed. It then starts again from the top (hence the name 'Event Loop').
Backlinks