new EventEmitter()
Creates an instance of EventEmitter class.
- Source:
Methods
-
emit(event, args)
-
Emits an event. The function calls all registered listeners in the order they have been added. The provided args param will be passed to each listener of the event.
Parameters:
Name Type Description event
string The name of the event. args
object Object, which will be passed to the listener as only argument. - Source:
-
off(event, callback)
-
Removes an event from the list of event listeners to some event.
Parameters:
Name Type Description event
string The name of the event. callback
function Callback method to be removed from the list of listeners. - Source:
-
on(event, callback)
-
Adds event listener to an event.
Parameters:
Name Type Description event
string The name of the event. callback
function Callback method to be invoked when event is being emitted. - Source: