Type alias MapEventType

MapEventType: {
    boxzoomcancel: MapLibreZoomEvent;
    boxzoomend: MapLibreZoomEvent;
    boxzoomstart: MapLibreZoomEvent;
    click: MapMouseEvent;
    contextmenu: MapMouseEvent;
    data: MapDataEvent;
    dataabort: MapDataEvent;
    dataloading: MapDataEvent;
    dblclick: MapMouseEvent;
    drag: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    dragend: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    dragstart: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    error: ErrorEvent;
    idle: MapLibreEvent;
    load: MapLibreEvent;
    mousedown: MapMouseEvent;
    mousemove: MapMouseEvent;
    mouseout: MapMouseEvent;
    mouseover: MapMouseEvent;
    mouseup: MapMouseEvent;
    move: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
    moveend: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
    movestart: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
    pitch: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    pitchend: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    pitchstart: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    remove: MapLibreEvent;
    render: MapLibreEvent;
    resize: MapLibreEvent;
    rotate: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    rotateend: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    rotatestart: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
    sourcedata: MapSourceDataEvent;
    sourcedataabort: MapSourceDataEvent;
    sourcedataloading: MapSourceDataEvent;
    styledata: MapStyleDataEvent;
    styledataloading: MapStyleDataEvent;
    styleimagemissing: MapStyleImageMissingEvent;
    terrain: MapTerrainEvent;
    tiledataloading: MapDataEvent;
    touchcancel: MapTouchEvent;
    touchend: MapTouchEvent;
    touchmove: MapTouchEvent;
    touchstart: MapTouchEvent;
    webglcontextlost: MapContextEvent;
    webglcontextrestored: MapContextEvent;
    wheel: MapWheelEvent;
    zoom: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
    zoomend: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
    zoomstart: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
}

MapEventType - a mapping between the event name and the event value. These events are used with the Map#on method. When using a layerId with Map#on method, please refer to MapLayerEventType. The following example can be used for all the events.

Type declaration

Example

// Initialize the map
let map = new Map({ // map options });
// Set an event listener
map.on('the-event-name', () => {
console.log('An event has occurred!');
});