This is a custom lightweight EventEmitter, based on Nodejs EventEmitter
.
Adds the event name and handler function to the end of the handlers array. No checks are made to see if the handler has already been added. Multiple calls passing the same combination of event name and handler will result in the handler being added, and called, multiple times.
event: String
- The name of the eventhandler: Function
- The callback function
EventEmitter
Adds a one-time handler function for the named event. The next time event is triggered, this handler is removed and then invoked.
event: String
- The name of the eventhandler: Function
- The callback function
EventEmitter
Removes all instances for the specified handler from the handler array for the named event.
event: String
- The name of the eventhandler: Function
- The callback function
EventEmitter
Synchronously calls each of the handlers registered for the named event, in the order they were registered, passing the supplied arguments to each.
event: String
- The name of the event...args: any[]
- arguments to pass to the event
Boolean
- returns true if the event had listeners, false otherwise.
Removes all listeners, or those of the specified named event.
event: String
- The name of the event. Optional
EventEmitter
Returns the number of listeners listening to the named event.
event: String
- The name of the event
Number
- number of listeners registered to the named event
Returns a copy of the array of listeners for the named event including those created by .once().
event: String
- The name of the event
Function[]
- array of listeners registered to the named event
Returns an array listing the events for which the emitter has registered handlers.
String[]
- array of named events that are registered