Event emitter raises the event called
messageLogged
and passes parameters
const EventEmitter = require('events');
const emitter = new EventEmitter();

// Register a listener
emitter.on('messageLogged', function(arg1, arg2) {
  console.log('Listener called', arg2, arg1);
});

// Raise an event
emitter.emit('messageLogged', 'arg-first', 'arg-second');
by Valeri Tandilashvili
2 years ago
Node
Events
Node.js Tutorial for Beginners - 1 Hour
0
Pro tip: use ```triple backticks around text``` to write in code fences