messageLogged
and passes the object as an argumentconst EventEmitter = require('events');
const emitter = new EventEmitter();
// Register a listener
emitter.on('messageLogged', function(obj) {
console.log('Listener called', obj);
});
// Raise an event & passes the object
emitter.emit('messageLogged', {key1: 'Value 1', key2: 'Value 2'});