Skip to main content

Base Map Events

BaseMapChanged

Description

The BaseMapChanged event is triggered when a user changes the base map type on a Dashboard or Record Level Maptaskr Map. This event provides information about the new base map type and its associated URL.

Usage

To listen for the BaseMapChanged event, you can use the on method of the window.top['maptaskrCORE'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example

window.top['maptaskrCORE'][controlId].on("BaseMapChanged", function(baseMapType, url) {
console.log("baseMapType: " + baseMapType);
console.log("url: " + url);
});

In the example above, we've registered an event listener for the BaseMapChanged event. When the event occurs, the provided call-back function is executed, logging the new base map type and its associated URL to the console.

Parameters

  • baseMapType (string): The type or category of the new base map.
  • url (string): The URL or source of the new base map.

Removing Event Listeners

To remove the event listener for the BaseMapChanged event, you can use the off method of the window.top['maptaskrCORE'] object. This is useful when you no longer want to listen for this specific event.

Example

window.top['maptaskrCORE'][controlId].off("BaseMapChanged");

In the example above, the event listener for BaseMapChanged is removed, ensuring that the associated call-back function no longer executes when the event is triggered.