Event handling gives a browser-based interface interactivity: code registers listener functions, which the browser invokes when matching events occur. section 4.3
Events are processed in turn:
- The browser queues detected events in order. It checks the queue and runs the associated handler, if one exists; other events wait until that handler finishes. section 4.3.1
- Because only one event is handled at a time, lengthy handlers can make an application unresponsive. section 4.3.1
A page that reports events
A small interface appends messages to a list when DOMContentLoaded fires and whenever a keydown event occurs. Typing “asdf” produces one message for each key press. section 4.1
Figure 4.6 In the event-handling phase, all events (whether coming from the user, such as mouse clicks and key presses, or coming from the server, such as fetch events) are queued up as they occur and are processed as the single thread of execution allows.
The figure traces how detected events enter a queue and are handled as the single thread allows. section 4.3.1


