Event Listeners
Below are the main event handlers available for extending Maptaskr Power Maps functionality. You can listen for map and control events using the on method of the Maptaskr Control Manager. For detailed usage and parameter information, refer to the documentation below.
Example usage:
// Listen for when feature drawing starts
const control = globalThis.MaptaskrControlManager.getControl(controlId);
control.on("FeatureDrawingStarted", (shapeName, featureType, startLat, startLng) => {
  console.log(shapeName, featureType, startLat, startLng);
});
About events in Maptaskr Power Maps
In previous versions, event listeners were wrapped in a window.maptaskrReady function, typically in a Dynamics JS file or Power Pages template. This approach worked when only one map was present on the page.
With Maptaskr Power Maps, you can now have multiple maps on a single page. Extension methods should be defined as standalone functions (the function name can remain mapReady or be customized). Remove the window wrapper, and add your function name to the your Config Manger profile (Custom code  → Custom JS). The new Custom JS control will automatically run your functions once the target control has loaded.
Supported Events
| Category | Event Name | Callback Signature / Parameters | Description | 
|---|---|---|---|
| Feature Drawing | FeatureDrawingStarted | (shapeName, featureType, startLat, startLng) | User begins drawing a feature (point/line/polygon). | 
| Feature Drawing | FeatureDrawingCompleted | (shapeName, featureType, startLat, startLng, geometry) | Feature drawing finishes and GeoJSON is emitted. | 
| Feature Drawing | FeatureDrawingCancelled | (shapeName) | Feature drawing was cancelled before completion. | 
| Feature Drawing | FeatureDrawingDeleted | (shapeName, type) | Previously drawn feature deleted. | 
| Feature Drawing | FeaturesSelected | (features) | One or more features selected in UI. | 
| Shape Drawing | ShapeDrawingStarted | (shapeName, shapeType, shapeId) | User begins drawing a shape (record-level context). | 
| Shape Drawing | ShapeDrawingCompleted | (shapeName, geojson, shapeId) | Shape drawing finishes; GeoJSON + id available. | 
| Shape Drawing | ShapeDrawingCancelled | (shapeName, shapeId) | Shape drawing cancelled. | 
| Shape Drawing | ShapeDrawingCleared | (shapeName, shapeId) | Transient drawing state cleared (context reset). | 
| Shape Drawing | ShapeDrawingDeleted | (shapeName, shapeId) | Saved / working shape deleted. | 
| Shape Drawing | ShapeDrawingFileSelected | (shapeName, file, shapeId) | User selected/imported a shape file. | 
| Layer | LayerAdded | (layerId) | Layer added to map UI. | 
| Layer | LayerFilterApplied | (layerId, subLayerId, filterGroup, instanceId) | Filter applied to layer/sublayer. | 
| Search | SearchExecuted | (term) | A search term submitted. | 
| Search | SearchResultsFound | (groupName, results) | Results returned for a search group. | 
| Search | RecordAddressSet | (searchResult) | Record-level address fields populated. | 
| Measurement | MeasurementStarted | (measurementType, startLat, startLng) | User begins a measurement session. | 
| Measurement | MeasurementCompleted | (measurementType, finishLat, finishLong, polygon, measurementText) | Measurement finalized; geometry + text summary available. | 
| Measurement | MeasurementCancelled | (measurementType) | Measurement aborted. | 
| Measurement | MeasurementsCleared | () | All measurement overlays cleared. | 
| Map | MapDownloaded | (fileName, base64Image) | Map export generated (intercepts default download). | 
| Map | BasemapChanged | (measurementType, url) | Basemap style changed. | 
| Map | ZoomChanged | (zoomLevel) | Zoom level changed. | 
| Map | MapClicked | (lat, lng) | User clicked map canvas. | 
| Map | ExtentChanged | (extent) | Map viewport extent changed. | 
| Map | SavingCompleted | () | User confirmed & saved shape(s); retrieve ids via callback. |