Telogis.GeoBase.EventHandler |
Provides a way to organize a collection of functions and call them all at once when a certain event occurs. Other EventHandlers can also be queued for execution once the calling handler has been triggered, but less flexibility is available than for functions.
Name | Description |
---|---|
append (Function callback, Number priority, Boolean once) | Adds a callback to the EventHandler. Arguments
|
appendOnce (Function callback, Number priority) | Adds a callback to the EventHandler such that it is executed the next time the event is triggered along with the rest of the normally registered callbacks, but then unregistered. Arguments
|
appendTransient (Function callback, Boolean replace) | Adds a callback to the EventHandler that should be called once, but never again. Furthermore, the next time the event is triggered, only this callback will be triggered: the non-transient functions will not be called. If multiple transient functions are appended, they are queued such that one is called per triggering, in the order they were added. Arguments
|
beforeNextAppend (Function callback) | Adds a callback to the EventHandler that will be called immediate before the next time a listener is appended. This is useful for lazily-binding events. Arguments
|
destroy () | Frees all the callbacks managed by the EventHandler to break circular references and allow the handler (and, more importantly, its parent object) to be garbage collected. EventHandlers are especially prone to memory leaks, since they retain a reference to the object that references them, for use in scoping. |
disable () | Stops the event handler from performing any actions. |
enable () | Allows the event handler to perform actions. |
isRegistered (Function callback) | Checks whether a callback is registered in the EventHandler. Arguments
|
remove (Function callback) | Removes a (non-transient) callback from the EventHandler. Arguments
|
replace (Function callback) | Equivalent to calling EventHandler.appendTransient with EventHandler.appendTransient.replace set to true. Arguments
|
trigger () | Triggers the event, causing all of its registered callbacks to be called if no transient events are registered. If one or more transient events are registered, the first of these is called and the function returns. All functions are called in window scope. |