Chapter 9. Composing the asynchronous
This chapter covers
- The limits of processing data synchronously
- How an event loop works and why you need to think asynchronously
- Events as data and data as events
- Event emitters and how to compose event streams
Remember imperative programs? They’re a bit like the list of chores that Scruffy’s mum used to leave him:
- Clean your room
- Take out the trash
- Do your homework
- No games until you finish your chores!
Scruffy could do the chores in any order, but he couldn’t play until the chores were finished. If everything is synchronous, then games just go after chores:
chores() games()
You’ve learned about things that are asynchronous. If Scruffy pays Agtron to do his chores, then he can start his games ...
Get CoffeeScript in Action 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.