Chapter 4. Events: Mastering EventEmitter and beyond
This chapter covers
- Using Node’s EventEmitter module
- Managing errors
- How third-party modules use EventEmitter
- How to use domains with events
- Alternatives to EventEmitter
Node’s events module currently includes just a single class: EventEmitter. This class is used throughout both Node’s built-in modules and third-party modules. It contributes to the overall architecture of many Node programs. Therefore it’s important to understand EventEmitter and how to use it.
It’s a simple class, and if you’re familiar with DOM or jQuery events, then you shouldn’t have much trouble understanding it. The major consideration when using Node is in error handling, and we’ll look at this in technique ...
Get Node.js in Practice 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.