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:
-
type
StringThe event name to emit
-
data
MixedAny 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:
-
type
StringThe event name to emit
-
listener
FunctionThe function to remove
Returns:
Mixed:
Returns itself.
on
(
Mixed
chainable
-
type
-
listener
Registers a listener function to be run on an event occurance
Parameters:
-
type
StringThe event name to listen for
-
listener
FunctionThe 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:
-
type
StringThe event name to listen for
-
listener
Functionthe callback to call when the event occurs
Returns:
Mixed:
Returns itself.