Adventures with the JavaScript Event Loop
The Event Loop underpins everything that happens in JavaScript. It’s how JavaScript handles I/O events without blocking, even though it’s single-threaded. It's responsible for executing callbacks and managing repainting.
In this talk, we'll have a look at how the Event Loop interacts with WebAPIs and the rendering pipeline and how it manages tasks and task queues. And we'll see what's so special about Promises and check out event loops outside the browser window, in Node and web workers.
Outline/Structure of the Talk
- Tasks: how they're created and executed
- Overview of task queues & the rendering pipeline and how they interact
- Special kinds of queues: microtask queue, animation frame callback queue
- Node and its queues
- Event Loops in web workers and other multi-threaded environments
Learning Outcome
.A solid understanding of the JavaScript event loop, in a number of environments, including how Promises, setImmediate, process.nextTick and requestAnimationFrame work.
Target Audience
JavaScript developers (front end & Node)