Class Dmp.Util.EventManager
Constructor Attributes | Constructor Name and Description |
---|---|
Center for adding observers, callbacks, and sending notifcations of event occurrances
|
Method Attributes | Method Name and Description |
---|---|
addCallback(eventType, callback, noDeadEvent)
adds a callback.
|
|
addObserver(observer, funcName, eventType, priority, noDeadEvent)
Lower the priority earlier you get the callback
|
|
getObservers(eventType)
|
|
indexOf(priorityArray, observer)
|
|
notify()
Notifies all listeners of the specified event.
|
|
remove(observer, eventType)
calls the removeObserver function
|
|
removeAll(eventType)
removes all observers listening to 'eventType'
|
|
removeCallback(eventType, callback)
remove all callbacks from this eventManager associated with the eventType
|
|
removeObserver(observer, eventType)
If no observer is provided, all observers listening to 'eventType' are removed
Otherwise, just the specified observer is removed
|
|
setDispatchedEvent(eventType, evtObj)
signal that this particular event is dead
|
Method Detail
addCallback(eventType, callback, noDeadEvent)
adds a callback. Listens to 'eventType'. Internally adds an observer
- Parameters:
- {String} eventType
- {function} callback
- {int} priority.
- Lower value = higher priority
- {boolean} noDeadEvent
addObserver(observer, funcName, eventType, priority, noDeadEvent)
Lower the priority earlier you get the callback
- Parameters:
- {Object} observer
- {String} funcName
- {String} eventType
- {int} priority
- {boolean} noDeadEvent
getObservers(eventType)
- Parameters:
- {String} eventType
- Returns:
- all observers listening to 'eventType'
indexOf(priorityArray, observer)
- Parameters:
- {Array} priorityArray
- {Object} observer
- Returns:
- index of the observer
notify()
Notifies all listeners of the specified event.
Order of notification respects each listener's priority
- Parameters:
- {Object} evtObj.
- 'eventType' must be a property of the evtObj
remove(observer, eventType)
calls the removeObserver function
- Parameters:
- {Object} observer
- {String} eventType
- See:
- removeObserver
removeAll(eventType)
removes all observers listening to 'eventType'
- Parameters:
- {String} eventType
removeCallback(eventType, callback)
remove all callbacks from this eventManager associated with the eventType
- Parameters:
- {String} eventType
- {function} callback
removeObserver(observer, eventType)
If no observer is provided, all observers listening to 'eventType' are removed
Otherwise, just the specified observer is removed
- Parameters:
- {Object} observer
- {Object} eventType
setDispatchedEvent(eventType, evtObj)
signal that this particular event is dead
- Parameters:
- {String} eventType
- {Object} evtObj