Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

EventEmitter to emit a custom event

const EventEmitter = require('events');
const eventEmitter = new EventEmitter ();

eventEmitter.on('greet', () => {
  console.log('Hello world!');
});

eventEmitter.emit('greet');
 
PREVIOUS NEXT
Tagged: #EventEmitter #emit #custom #event
ADD COMMENT
Topic
Name
9+5 =