event module

Solutions on MaxInterview for event module by the best coders in the world

showing results for - "event module"
Laura
29 Feb 2019
1const EventEmitter = require('events');
2const myEE = new EventEmitter();
3myEE.on('foo', () => {});
4myEE.on('bar', () => {});
5
6const sym = Symbol('symbol');
7myEE.on(sym, () => {});
8
9console.log(myEE.eventNames());
10// Prints: [ 'foo', 'bar', Symbol(symbol) ]