Chapter 1Understanding JavaScript Events
Events. How do they work? Confusion about JavaScriptâs asynchronous event model is as old as JavaScript itself. Confusion leads to bugs, bugs lead to anger, and Yoda taught us the restâ¦.
Yet at heart, JavaScript events are both conceptually elegant and practical. Once youâve accepted the languageâs single-threaded design, it feels like a feature rather than a limitation. It means that your code is uninterruptible and that the events you schedule line up in an orderly fashion.
In this chapter, weâll take a tour of JavaScriptâs asynchronous mechanisms and dispel some common misconceptions. Weâll see what setTimeout really does. Then weâll discuss handling errors in callbacks. Finally, ...
Get Async JavaScript 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.