Skip to content
skillbld
Node.js · 14-day planAll days
Day 7 of 14 30 min

Much of Node is event-driven. Learn the EventEmitter class behind servers and streams, add and remove listeners, use once and events.once, handle the special error event, and build your own event-driven classes.

By the end of today you can

  • Emit events and listen for them with EventEmitter
  • Use once, off and listenerCount
  • Handle the special error event correctly
  • Build a class that extends EventEmitter
  • Await an event with events.once

What's inside

  • 6 sections
  • 2 diagrams and mind maps
  • 5 code examples you can run
  • 5-question quiz
  1. 1Emitting and listening
  2. 2once, off and listener management
  3. 3The error event
  4. 4Your own event-driven classes
  5. 5Waiting for an event with events.once
  6. 6When to use events

Sign in free to read this lesson

Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.

Sign in free

Keep going

Day 7: Events & EventEmitter · Node.js · SkillBld