Node.js · 14-day planAll days
Day 7 of 14 30 minEventEmitterListenersErrors
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
- 1Emitting and listening
- 2once, off and listener management
- 3The error event
- 4Your own event-driven classes
- 5Waiting for an event with events.once
- 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