O'Reilly logo

Node.js in Practice by Alex Young and Marc Harter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required