emitter.rawListeners(eventName)
This
method returns a copy of the array of listeners for the event named eventName.
var EventEmitter = require('events').EventEmitter; var emitter = new EventEmitter(); var goodMorning = () => { console.log('Good Morning'); } var welcome = () => { console.log('Welcome to node.js programming'); } emitter.on('hello', goodMorning); emitter.on('hello', welcome); var listeners = emitter.rawListeners('hello'); for(index in listeners){ console.log(listeners[index]); }
Output
[Function:
goodMorning]
[Function:
welcome]
No comments:
Post a Comment