Files
main.tsmain
What you'll learn
- Register EventEmitterModule and emit namespaced events with class payloads from a service
- Listen with @OnEvent on any provider, including a wildcard over a namespace
- Explain what events buy over direct calls, and when a listener runs relative to the response
Press Run tests to start the app. Its log appears here.Graded endpoints
Saved, then cat.created is emitted
A second arrival
Saved, then cat.adopted is emitted with who adopted
Refused before anything is emitted
Three entries from two listeners in a module that never imports CatsService
The wildcard listener counted every cat.* event; the adoption listener counted one