Layer Events

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

EventDescription
tileloadstartTriggered when a tile starts loading. Listeners receive an object as first argument, which has a tile property that references the tile that starts loading.
tileloadedTriggered 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.
tileerrorTriggered 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

EventDescription
beforefeatureaddedTriggered 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.
beforefeaturesaddedTriggered 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.
featureaddedTriggered after a feature is added. The event object passed to listeners will have a feature property with a reference to the added feature.
featuresaddedTriggered after features are added. The event object passed to listeners will have a features property with a reference to an array of added features.
beforefeatureremovedTriggered before a feature is removed. Listeners will receive an object with a feature property referencing the feature to be removed.
beforefeaturesremovedTriggered before multiple features are removed. Listeners will receive an object with a features property referencing the features to be removed.
featureremovedTriggered after a feature is removed. The event object passed to listeners will have a feature property with a reference to the removed feature.
featuresremovedTriggered after features are removed. The event object passed to listeners will have a features property with a reference to an array of removed features.
refreshTriggered when something wants a strategy to ask the protocol for a new set of features.

Marker Layer Events

Supported Events

EventDescription
beforemarkeraddedTriggered 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.
beforemarkersaddedTriggered 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 August 13, 2019.