EventDispatcher.js

EventDispatcher()


constructor

EventDispatcher class is used to catch and dispatch custom events

on()


method

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

fire()


method

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

detach()


method

Removes an event listener

Parameter Type Description
eventName String The name of the event
fn Function The function associated with the given event name that will be removed from list of listeners

detachAll()


method

Detaches all functions from all events

generateUUID()


method

RFC4122 version 4 compliant solution for generating a UUID