new Listener( event, target, callback [, options ] )

Description

The Listener class represents a single event listener object. Such objects keep all relevant contextual information such as the event being listened to, the object the listener was attached to, the callback function and so on.

Parameters
Name Type Attributes Default Description
event string | Symbol

The event being listened to

target EventEmitter

The EventEmitter object that the listener is attached to.

callback EventEmitter~callback

The function to call when the listener is triggered

options Object <optional>
{}
Name Type Attributes Default Description
context Object <optional>
target

The context to invoke the listener in (a.k.a. the value of this inside the callback function).

remaining number <optional>
Infinity

The remaining number of times after which the callback should automatically be removed.

arguments array <optional>

An array of arguments that will be passed separately to the callback function upon execution. The array is stored in the arguments property and can be retrieved or modified as desired.

Throws

The event parameter must be a string or EventEmitter.ANY_EVENT.

The target parameter is mandatory.

The callback must be a function.

Details

Classes


new Listener( event, target, callback [, options ] )

Members


arguments :array

Description

An array of arguments to pass to the callback function upon execution.

Details
array

callback :function

Description

The callback function to execute.

Details
function

context :Object

Description

The context to execute the callback function in (a.k.a. the value of this inside the callback function)

Details
Object

count :number

Description

The number of times the listener function was executed.

Details
number

event :string

Description

The event name.

Details
string

remaining :number

Description

The remaining number of times after which the callback should automatically be removed.

Details
number

suspended :boolean

Description

Whether this listener is currently suspended or not.

Details
boolean

target :EventEmitter

Description

The object that the event is attached to (or that emitted the event).

Details

Methods


remove()

Description

Removes the listener from its target.

Details