What We’ve Learned

In this chapter, we’ve seen how JavaScript’s single-threadedness is both a blessing and a curse. In the right hands, it makes for beautiful code free of the terrifying race conditions that plague multithreaded apps. But you need to develop the right mind-set—and the right techniques.

The rest of this book is concerned with libraries and design patterns for working with events in JavaScript. All of the examples we’ll look at will run in either mainstream browsers or unmodified Node.js. However, writing JavaScript isn’t the only way to produce JavaScript code. For an overview of some interesting alternatives, see Appendix 1, ​Tools for Taming JavaScript​.

It bears mention here that there is one kind of multithreading ...

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.