EventEmitter in NodeJS example

Hi all, I have been studying the NodeJS course and coming to the EventEmitter lesson.
But at the end of the lesson, I have a confusing thing where 2nd row, there has got an assignment statement of EventEmitter, I wonder why we need the assignment because there has already had another assignment in the logger.js module.
Anyone please help me to clear this question.

Thank you so much

I really want to help you out, However , I can’t figure out you question…

Can you re-write it please!!!


As mosh said in that video, every EventEmitter in each module are different from one another:

here we are working with two different EventEmitters, in app js we have this EventEmitter object, and in logger module, we have another EventEmitter object.
so earlier I told you that a class is like a blueprint and an object is an actual instance.
As a metaphor I said we could have a class called human, or person, but the object would be Jack, John, Mary, Bob, whatever.
So in this case we have two different objects, in the logger module you’re using this emitter object to emit an event, where as in app module we’re using another event emitter object to handle that event, These are completely different.
So when we register a listener here(app.js module), that listener is only registered with this EventEmitter which is completely different from the other EventEmitter

So they are not the same .
the EventEmitter object in logger.js module is responsible for raising an event, whereas in app.js is to listen for that raised event.

I hope that helped you a little :slightly_smiling_face: