© Yiyi Sun 2019
Yiyi SunPractical Application Development with AppRunhttps://doi.org/10.1007/978-1-4842-4069-4_6

6. Asynchronous Events

Yiyi Sun1 
(1)
Thornhill, ON, Canada
 

The JavaScript runtime executes event handlers one at a time in the event loop. If an event handler takes a long time to execute, the user interface appears to be unresponsive or frozen. This is because the JavaScript runtime must wait for the event handler to finish. The code execution is blocked while waiting. To avoid blocking the code execution, JavaScript uses a technique called asynchronous operations.

For example, getting data from a back-end server over the Internet requires a comparatively long-running code execution. It requires us to define a function as the callback ...

Get Practical Application Development with AppRun: Building Reliable, High-Performance Web Apps Using Elm-Inspired Architecture, Event Pub-Sub, and Components now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.