EventDispatcher()
constructor
EventDispatcher class is used to catch and dispatch custom events
EventDispatcher's constructor
Adds a listener to an event
Fires an event
Removes an event listener
Detaches all functions from all events
RFC4122 version 4 compliant solution for generating a UUID
Adds a listener to an event
Parameter | Type | Description |
---|---|---|
eventName | String | The name of the event for which to add the listener |
fn | Function | The callback function that will be called when the event is fired |
context | Object | The context in which the callback will be called |
Fires an event
Parameter | Type | Description |
---|---|---|
eventName | String | The name of the event that will be fired |
params | Object | The parameters that will be sent to the callback functions of the listeners |