eventEmitter

eventEmitter

Event Emitter

Methods

emit(name)

Emit an event

Parameters:
Name Type Description
name string
...rest any

arguments for the event

off(name, callback)

Unsubscribe from an event or all events. If no callback is provided, it unsubscribes all callback from this event.

Parameters:
Name Type Description
name string
callback function

on(name, callback, contextopt)

Subscribe to an event.

Parameters:
Name Type Attributes Description
name string
callback function
context any <optional>

once(name, callback, contextopt)

Subscribe to an event only once.

Parameters:
Name Type Attributes Description
name string
callback function
context any <optional>