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;
};
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn