Skip to content

EventEmitter.hasListener

Dragiyski edited this page Mar 28, 2015 · 1 revision

Check if the object has any listener or specified listener function.

Usage

emitter.hasListener()
emitter.hasListener(event);
emitter.hasListener(event, listener);

Arguments

Argument Type Required Description
event string The name of the event.
listener function A function.

Return

In the first form, the method returns true if the event emitter has any events at all.

In the second form, the method returns true if the event emitter has listeners for specified event.

In the third form, the method returns true the event emitter has specified listener for specified event.

In any other case method returns false.

Clone this wiki locally