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 ...
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.