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

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

// Raise an event
emitter.emit('messageLogged');
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