I have tried to pass an event from a class to another function, the emit event is not passing to that function.
App.js
const Logger = require('./logger');
const logger = new Logger();
logger.on('msgLoged', (arg) => {
console.log("6. Listner called !!!", arg);
});
logger.js
const EventEmitter = require('events');
class Logger extends EventEmitter {
log(message) {
console.log(message);
this.emit('msgLoged', {id: 1, data: "someathing"})
}
}