Namespace: EventDispatcher

EventDispatcher

Event Dispatcher Implementation of an event dispatcher following the Mediator pattern
Source:

Methods

(static) emit(evtName, params)

Emits an event, all registered callbacks are called

Parameters:
Name Type Description
evtName String name of the event
params Mixed additional parameters passed to the callback
Source:

(static) evtName(evtName) → {String}

Adds a prefix to the event name

Assures that event name doesn't match a standard Object property name
Parameters:
Name Type Description
evtName String event name
Source:
Returns:
prefixed event name
Type
String

(static) register(evtName, callback, bind)

Registers a callback to an event

Parameters:
Name Type Description
evtName String name of the event
callback function function binded to the event
bind Mixed the value of this provided to the callback
Source:
Returns:
void

(static) unregister(evtName, callback)

Unregisters one or all callbacks binded to the given event

Parameters:
Name Type Description
evtName String name of the event
callback function function to unregister. All callbacks if empty
Source:
Returns:
void