In Node.js how does the event loop work? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
开发者_如何学运维 Improve this questionI would like to understand the event-loop module - exactly what's going on behind the scene (OS wise, Thread wise) in node.js What happen when someone write to a file and apply a callback. how does the setTimeout work?
The event loop mechanism is almost same on frontend and backend if you're using Node or JS. The setTimeout is not part of JS or Node, this method is part of browser API (frontend) and V8 engine(backend). You can understand it visually with this video by Phillip: https://www.youtube.com/watch?v=8aGhZQkoFbQ
Once, the broader concept is clear, you can read more about Microtasks
, https://javascript.info/microtask-queue
精彩评论