Method description:
Returns the number of listeners registered for the specified event.
Syntax:
EventEmitter.listenerCount(emitter, event)
Receive parameters:
emitter Event Emitter
event event
Example:
if(events.EventEmitter.listenerCount(this, 'feedback') == 0) {
//....
}
Source code:
EventEmitter.listenerCount = function(emitter, type) {
var ret;
if (!emitter._events || !emitter._events[type])
ret = 0;
else if (util.isFunction(emitter._events[type]))
ret = 1;
else
ret = emitter._events[type].length;
Return ret;
};