Skip to main content

Base Map Events

BaseMapChanged​

Description​

The BaseMapChanged event is triggered when a user changes the base map type on a map using the Maptaskr for Power Pages App. 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['maptaskrPCF'] object. This allows you to register an event listener that executes a call-back function when the event is triggered.

Example​

window['maptaskrPCF'].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['maptaskrPCF'] object. This is useful when you no longer want to listen for this specific event.

Example​

window['maptaskrPCF'].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.