An event is an occurrence the browser detects, such as a click, timer firing, or network response. Browser applications are largely event-driven: code commonly runs in response to events. section 1.2
The browser processes detected events one at a time:
- It places events in a queue in the order they are detected. section 2.3.1
- When an event reaches the head of the queue, the browser runs its associated handler, if one exists; other events wait. section 2.3.1
- Keep handlers brief: a long-running handler delays other events and can make the application unresponsive. section 2.3.1
Figure 2.8. 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 Ajax events) are queued up as they occur and are processed as the single thread of execution allows.
See how user and server events wait in a queue while the browser’s single thread processes them. section 2.3.1

















