Click or drag to resize

Telogis.GeoBase.EventHandler

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release

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.

Functions
NameDescription
append (Function callback, Number priority, Boolean once)

Adds a callback to the EventHandler.

Arguments
  • callback (Function) - The arbitrary function that should be called when the handler is triggered.

  • priority (Number) - An optional parameter specifying the priority of this callback. Callbacks with a lower number priority are executed before callbacks with a higher priority number. The default value is a priority of 5.

  • once (Boolean) - Set to true to call the function only once when the handler is triggered.

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
  • callback (Function) - The arbitrary function that should be called when the handler is triggered.

  • priority (Number) - An optional parameter specifying the priority of this callback. Callbacks with a lower number priority are executed before callbacks with a higher priority number. The default value is a priority of 5.

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
  • callback (Function) - The arbitrary function that should be called next time the handler is triggered.

  • (Optional) replace (Boolean) - Set to true to override any existing transient callbacks. Defaults to false.

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
  • callback (Function) - The function that should be called immediately before the next time a listener is appended to the handler.

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
  • callback (Function) - The function to check for.

remove (Function callback)

Removes a (non-transient) callback from the EventHandler.

Arguments
  • callback (Function) - The function or handler that should be removed from the handler trigger.

replace (Function callback)

Equivalent to calling EventHandler.appendTransient with EventHandler.appendTransient.replace set to true.

Arguments
  • callback (Function) - The arbitrary function that should be called next time the handler is triggered.

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.