EventEmitter Class
Event emitter mixin. This will add emitter properties to an object so that it can emit events, and have others listen for them. Based on node.js event emitter
Constructor
EventEmitter
()
Methods
emit
(
Mixed
chainable
-
type -
data
Emits an event which will run all registered listeners for the event type
Parameters:
-
typeStringThe event name to emit
-
dataMixedAny data you want passed along with the event
Returns:
Mixed:
Returns itself.
off
(
Mixed
chainable
-
type -
listener
Removes a listener function for an event type
Parameters:
-
typeStringThe event name to emit
-
listenerFunctionThe function to remove
Returns:
Mixed:
Returns itself.
on
(
Mixed
chainable
-
type -
listener
Registers a listener function to be run on an event occurance
Parameters:
-
typeStringThe event name to listen for
-
listenerFunctionThe function to execute when the event happens
Returns:
Mixed:
Returns itself.
once
(
Mixed
chainable
-
type -
listener
Registers a one-time callback for an event
Parameters:
-
typeStringThe event name to listen for
-
listenerFunctionthe callback to call when the event occurs
Returns:
Mixed:
Returns itself.