In this lesson, you will learn what an EventEmitter is and how it works. We start with a simple example creating an instance of the EventEmitter class, then expand on it by building listeners and emitting events to trigger them. You will learn how to view listeners in the global emitter object, as well as how to remove them and understand what the EventEmitter memory leak message means. We wrap everything up by examining the http server class to illustrate how node.js uses EventEmitters in many places for core features.
I get undefined
for global.emitter
. Is this supposed to work in node version v8.9.4?
never mind my comment above. in your case emitter
is the name of your emitter and you added it via REPL, so it got put on the global namespace.