emitter.listenerCount(eventName)
Returns
a copy of the array of listeners for the event named eventName.
HelloWorld.js
var util = require('util'); var EventEmitter = require('events').EventEmitter; var emitter = new EventEmitter(); emitter.on('Hello', () =>{ console.log("Hello World"); }); emitter.on('Hello', (name) => { console.log(`Hello Mr ${name}`); }) console.log(util.inspect(emitter.listeners('Hello')));
Output
[ [Function], [Function] ]
[ [Function], [Function] ]
No comments:
Post a Comment