---
title: Handling map events
framework: mapkitjs
role: collectionGroup
role_heading: API Collection
path: mapkitjs/handling-map-events
---

# Handling map events

Register an event lister for events that a map object dispatches.

## Overview

Overview MapKit JS uses events that developers can implement to hook into points in the life cycle of the map, as well as user interactions. Your code can respond to events by registering an event listener. Events have a target property. The target of an event is the object dispatching that event. When you add an event listener to a map, the target is the map itself. The select and deselect events have an annotation or overlay property that reports the selected or deselected item. The single-tap, double-tap, and long-press events have pointOnPage and domEvents properties that provide more data about the user interactions. Event listeners receive a single argument that is an event object. The event objects are similar to native event objects, though calls to event.preventDefault() or event.stopPropagation() don’t halt some actions that trigger these events. Scrolling, zooming, and panning, as well as zooming or rotating after a long press, provide methods to halt or prevent interaction. Respond to map display events MapKit JS dispatches the following events that allow you to respond to changes in the map display and a person’s interactions with the map and its controls. Respond to annotation and overlay events MapKit JS sends MapAnnotationSelectionEvent,MapOverlaySelectionEvent, and MapAnnotationDragEvent events when a person interacts with the annotations and overlays you place on the map. Respond to these interactions by updating the map or providing more information about the overlay or annotation the person interacts with. Respond to user location events MapKit JS sends MapUserLocationChangeEvent or MapUserLocationErrorEvent events to indicate changes in a person’s location. Use these events to adjust what the map displays or to trigger other responses in your app. Respond to map interaction events MapKit JS sends MapEvent events when someone taps or presses on the map view. Use these events to adjust the map view, respond to the deselecting of overlays, or drag or deselect annotations.

## Topics

### Map events

- [MapEvent](mapkitjs/mapevent.md)
- [MapAnnotationDragEvent](mapkitjs/mapannotationdragevent.md)
- [MapAnnotationSelectionEvent](mapkitjs/mapannotationselectionevent.md)
- [MapOverlaySelectionEvent](mapkitjs/mapoverlayselectionevent.md)
- [MapUserLocationChangeEvent](mapkitjs/mapuserlocationchangeevent.md)
- [MapUserLocationErrorEvent](mapkitjs/mapuserlocationerrorevent.md)
