Skip to main content

Layer Events

Contents

Certain layers have a set of events that they are responsible for triggering so that other areas of the code can act accordingly. These events are specific to the layer’s class, and each layer can have several of these proprietary events. The events that are triggered by each of the layers are explained in the tables below.

Grid/BaseMap/Traffic/WeatherRadar Layer Events

Supported Events

Event Description
tileloadstart Triggered when a tile starts loading. Listeners receive an object as first argument, which has a tile property that references the tile that starts loading.
tileloaded Triggered when each new tile is loaded, as a means of progress update to listeners. Listeners can access “numLoadingTiles” if they wish to keep track of the loading progress. Listeners are called with an object with a tile property as first argument, making the loaded tile available to the listener.
tileerror Triggered before the tileloaded event (i.e. when the tile is still hidden) if a tile failed to load. Listeners receive an object as first argument, which has a tile property that references the tile that could not be loaded.

Vector/VectorMarkers/Routing/WeatherAlerts Layer Events

Supported Events

Event Description
beforefeatureadded Triggered before a feature is added. Listeners will receive an object with a feature property referencing the feature to be added. To stop the feature from being added, a listener should return false.
beforefeaturesadded Triggered before an array of features is added. Listeners will receive an object with a features property referencing the feature to be added. To stop the features from being added, a listener should return false.
featureadded Triggered after a feature is added. The event object passed to listeners will have a feature property with a reference to the added feature.
featuresadded Triggered after features are added. The event object passed to listeners will have a features property with a reference to an array of added features.
beforefeatureremoved Triggered before a feature is removed. Listeners will receive an object with a feature property referencing the feature to be removed.
beforefeaturesremoved Triggered before multiple features are removed. Listeners will receive an object with a features property referencing the features to be removed.
featureremoved Triggered after a feature is removed. The event object passed to listeners will have a feature property with a reference to the removed feature.
featuresremoved Triggered after features are removed. The event object passed to listeners will have a features property with a reference to an array of removed features.
refresh Triggered when something wants a strategy to ask the protocol for a new set of features.

Marker Layer Events

Supported Events

Event Description
beforemarkeradded Triggered before a marker is added. Listeners will receive an object with a marker property referencing the marker to be added. To stop the marker from being added, a listener should return false.
beforemarkersadded Triggered before an array of markers is added. Listeners will receive an object with a markers property referencing the marker to be added. To stop the markers from being added, a listener should return false.
Last updated November 23, 2021.
Contents