Chapter 13. Surviving events
This chapter covers
- Understanding the event loop
- Processing complex tasks with timers
- Managing animations with timers
- Using event bubbling and delegation
- Using custom events
Chapter 2 included a short discussion on the JavaScript single-threaded execution model and introduced the event loop and the event queue, in which events wait for their turn to be processed. This discussion was particularly useful when presenting the steps in the lifecycle of a web page, especially when discussing the order in which certain pieces of JavaScript code get executed. At the same time, it’s a simplification, so in order to get a more complete picture of how the browser works, we’ll spend a significant part of this chapter exploring ...
Get Secrets of the JavaScript Ninja, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.