EventManager class

A manager for the map control's events. Exposed through the events property of the atlas.Map class. Cannot be instantiated by the user.

Methods

add("boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend", (e: MapEvent) => void)

Adds an event to the map.

add("click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup", HtmlMarker | HtmlMarker[], (e: TargetedEvent) => void)

Adds an event to the HtmlMarker(s).

add("data" | "sourcedata" | "styledata", (e: MapDataEvent) => void)

Adds a data event to the map.

add("dataadded" | "dataremoved", DataSource | DataSource[], (e: Shape[]) => void)

Adds an event to the DataSource(s).

add("datasourceupdated", DataSource | DataSource[], (e: DataSource) => void)

Adds an event to the DataSource(s).

add("drag" | "dragend" | "dragstart" | "open" | "close", Popup | Popup[], (e: TargetedEvent) => void)

Adds an event to the Popup(s).

add("error", (e: MapErrorEvent) => void)

Adds an event to the map.

add("layeradded" | "layerremoved", (e: Layer) => void)

Adds an event to the map.

add("layeradded" | "layerremoved", Layer | Layer[], (e: Layer) => void)

Adds an event to the Layer(s).

add("mapconfigurationchanged", (e: MapConfiguration) => void)

Adds a mapConfiguration change event to the map.

add("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu", (e: MapMouseEvent) => void)

Adds a mouse event to the map.

add("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu", Layer | Layer[], (e: MapMouseEvent) => void)

Adds a mouse event to the Layer(s).

add("shapechanged", Shape | Shape[], (e: Shape) => void)

Adds an event to the Shape(s).

add("sourceadded" | "sourceremoved", (e: Source) => void)

Adds an event to the map.

add("sourceadded" | "sourceremoved", Source | Source[], (e: Source) => void)

Adds an event to the Source(s).

add("stylechanged", (e: StyleChangedEvent) => void)

Adds a wheel event to the map.

add("styleimagemissing", (e: string) => void)

Adds a style image missing event to the map.

add("styleselected", StyleControl, (e: string) => void)

Adds an event to the StyleControl

add("touchstart" | "touchend" | "touchmove" | "touchcancel", (e: MapTouchEvent) => void)

Adds a touch event to the map.

add("touchstart" | "touchend" | "touchmove" | "touchcancel", Layer | Layer[], (e: MapTouchEvent) => void)

Adds a touch event to the Layer(s).

add("wheel", (e: MapMouseWheelEvent) => void)

Adds a wheel event to the map.

add("wheel", Layer | Layer[], (e: MapMouseWheelEvent) => void)

Adds a wheel event to the Layer(s).

addOnce("boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend", (e: MapEvent) => void)

Adds an event to the map.

addOnce("click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup", HtmlMarker, (e: TargetedEvent) => void)

Adds an event to the HtmlMarker.

addOnce("data" | "sourcedata" | "styledata", (e: MapDataEvent) => void)

Adds a data event to the map.

addOnce("dataadded" | "dataremoved", DataSource, (e: Shape[]) => void)

Adds an event to the DataSource.

addOnce("datasourceupdated", DataSource, (e: DataSource) => void)

Adds an event to the DataSource.

addOnce("drag" | "dragend" | "dragstart" | "open" | "close", Popup, (e: TargetedEvent) => void)

Adds an event to the Popup.

addOnce("error", (e: MapErrorEvent) => void)

Adds an event to the map.

addOnce("layeradded" | "layerremoved", (e: Layer) => void)

Adds an event to the map.

addOnce("layeradded" | "layerremoved", Layer, (e: Layer) => void)

Adds a touch event to the Layer.

addOnce("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu", (e: MapMouseEvent) => void)

Adds a mouse event to the map.

addOnce("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu", Layer, (e: MapMouseEvent) => void)

Adds a mouse event to the Layer.

addOnce("shapechanged", Shape, (e: Shape) => void)

Adds an event to the Shape.

addOnce("sourceadded" | "sourceremoved", (e: Source) => void)

Adds an event to the map.

addOnce("sourceadded" | "sourceremoved", Source, (e: Source) => void)

Adds an event to the Source.

addOnce("stylechanged", (e: StyleChangedEvent) => void)

Adds a wheel event to the map.

addOnce("styleimagemissing", (e: string) => void)

Adds a style image missing event to the map.

addOnce("styleselected", StyleControl, (e: string) => void)

Adds an event to the StyleControl

addOnce("touchstart" | "touchend" | "touchmove" | "touchcancel", (e: MapTouchEvent) => void)

Adds a touch event to the map.

addOnce("touchstart" | "touchend" | "touchmove" | "touchcancel", Layer, (e: MapTouchEvent) => void)

Adds a touch event to the Layer.

addOnce("wheel", (e: MapMouseWheelEvent) => void)

Adds a wheel event to the map.

addOnce("wheel", Layer, (e: MapMouseWheelEvent) => void)

Adds a wheel event to the Layer.

invoke(string, any)

Invokes an event on the map. This causes all event handlers on the map with the specified event name to be called.

invoke(string, any, any)

Invokes an event of the target. This causes all event handlers on the target with the specified event name to be called.

remove(string, (e: void | Layer | MapEvent | MapDataEvent | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Source | string | MapConfiguration) => void)

Removes an event listener from the map.

remove(string, DataSource | DataSource[], (e: DataSource | Shape[]) => void)

Removes an event listener from the DataSource(s).

remove(string, HtmlMarker | HtmlMarker[], (e: TargetedEvent) => void)

Removes an event listener from the HtmlMarker(s).

remove(string, Layer | Layer[], (e: void | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Layer) => void)

Removes an event listener from the Layer(s).

remove(string, Popup | Popup[], (e: TargetedEvent) => void)

Removes an event listener from the Popup(s).

remove(string, Shape | Shape[], (e: Shape) => void)

Removes an event listener from the Shape(s).

remove(string, Source | Source[], (e: Source) => void)

Removes an event listener from the Source(s).

remove(string, StyleControl, (e: string) => void)

Removes an event to the StyleControl

Method Details

add("boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend", (e: MapEvent) => void)

Adds an event to the map.

function add(eventType: "boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend", callback: (e: MapEvent) => void)

Parameters

eventType

"boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend"

The event name.

callback

(e: MapEvent) => void

The event handler callback.

add("click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup", HtmlMarker | HtmlMarker[], (e: TargetedEvent) => void)

Adds an event to the HtmlMarker(s).

function add(eventType: "click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup", target: HtmlMarker | HtmlMarker[], callback: (e: TargetedEvent) => void)

Parameters

eventType

"click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup"

The event name.

target

HtmlMarker | HtmlMarker[]

The HtmlMarker(s) to add the event for.

callback

(e: TargetedEvent) => void

The event handler callback.

add("data" | "sourcedata" | "styledata", (e: MapDataEvent) => void)

Adds a data event to the map.

function add(eventType: "data" | "sourcedata" | "styledata", callback: (e: MapDataEvent) => void)

Parameters

eventType

"data" | "sourcedata" | "styledata"

The data event name.

callback

(e: MapDataEvent) => void

The event handler callback.

add("dataadded" | "dataremoved", DataSource | DataSource[], (e: Shape[]) => void)

Adds an event to the DataSource(s).

function add(eventType: "dataadded" | "dataremoved", target: DataSource | DataSource[], callback: (e: Shape[]) => void)

Parameters

eventType

"dataadded" | "dataremoved"

The event name.

target

DataSource | DataSource[]

The DataSource(s) to add the event for.

callback

(e: Shape[]) => void

The event handler callback.

add("datasourceupdated", DataSource | DataSource[], (e: DataSource) => void)

Adds an event to the DataSource(s).

function add(eventType: "datasourceupdated", target: DataSource | DataSource[], callback: (e: DataSource) => void)

Parameters

eventType

"datasourceupdated"

The event name.

target

DataSource | DataSource[]

The DataSource(s) to add the event for.

callback

(e: DataSource) => void

The event handler callback.

add("drag" | "dragend" | "dragstart" | "open" | "close", Popup | Popup[], (e: TargetedEvent) => void)

Adds an event to the Popup(s).

function add(eventType: "drag" | "dragend" | "dragstart" | "open" | "close", target: Popup | Popup[], callback: (e: TargetedEvent) => void)

Parameters

eventType

"drag" | "dragend" | "dragstart" | "open" | "close"

The event name.

target

Popup | Popup[]

The Popup(s) to add the event for.

callback

(e: TargetedEvent) => void

The event handler callback.

add("error", (e: MapErrorEvent) => void)

Adds an event to the map.

function add(eventType: "error", callback: (e: MapErrorEvent) => void)

Parameters

eventType

"error"

The error event name.

callback

(e: MapErrorEvent) => void

The event handler callback.

add("layeradded" | "layerremoved", (e: Layer) => void)

Adds an event to the map.

function add(eventType: "layeradded" | "layerremoved", callback: (e: Layer) => void)

Parameters

eventType

"layeradded" | "layerremoved"

The event name.

callback

(e: Layer) => void

The event handler callback.

add("layeradded" | "layerremoved", Layer | Layer[], (e: Layer) => void)

Adds an event to the Layer(s).

function add(eventType: "layeradded" | "layerremoved", target: Layer | Layer[], callback: (e: Layer) => void)

Parameters

eventType

"layeradded" | "layerremoved"

The event name.

target

Layer | Layer[]

The Layer(s) to add the event for.

callback

(e: Layer) => void

The event handler callback.

add("mapconfigurationchanged", (e: MapConfiguration) => void)

Adds a mapConfiguration change event to the map.

function add(eventType: "mapconfigurationchanged", callback: (e: MapConfiguration) => void)

Parameters

eventType

"mapconfigurationchanged"

A mapConfiguration changed event name

callback

(e: MapConfiguration) => void

The event handler callback

add("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu", (e: MapMouseEvent) => void)

Adds a mouse event to the map.

function add(eventType: "mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu", callback: (e: MapMouseEvent) => void)

Parameters

eventType

"mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu"

The mouse event name.

callback

(e: MapMouseEvent) => void

The event handler callback.

add("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu", Layer | Layer[], (e: MapMouseEvent) => void)

Adds a mouse event to the Layer(s).

function add(eventType: "mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu", target: Layer | Layer[], callback: (e: MapMouseEvent) => void)

Parameters

eventType

"mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu"

The event name.

target

Layer | Layer[]

The Layer(s) to add the event for.

callback

(e: MapMouseEvent) => void

The event handler callback.

add("shapechanged", Shape | Shape[], (e: Shape) => void)

Adds an event to the Shape(s).

function add(eventType: "shapechanged", target: Shape | Shape[], callback: (e: Shape) => void)

Parameters

eventType

"shapechanged"

The event name.

target

Shape | Shape[]

The Shape(s) to add the event for.

callback

(e: Shape) => void

The event handler callback.

add("sourceadded" | "sourceremoved", (e: Source) => void)

Adds an event to the map.

function add(eventType: "sourceadded" | "sourceremoved", callback: (e: Source) => void)

Parameters

eventType

"sourceadded" | "sourceremoved"

The event name.

callback

(e: Source) => void

The event handler callback.

add("sourceadded" | "sourceremoved", Source | Source[], (e: Source) => void)

Adds an event to the Source(s).

function add(eventType: "sourceadded" | "sourceremoved", target: Source | Source[], callback: (e: Source) => void)

Parameters

eventType

"sourceadded" | "sourceremoved"

The event name.

target

Source | Source[]

The Source(s) to add the event for.

callback

(e: Source) => void

The event handler callback.

add("stylechanged", (e: StyleChangedEvent) => void)

Adds a wheel event to the map.

function add(eventType: "stylechanged", callback: (e: StyleChangedEvent) => void)

Parameters

eventType

"stylechanged"

The wheel event name.

callback

(e: StyleChangedEvent) => void

The event handler callback.

add("styleimagemissing", (e: string) => void)

Adds a style image missing event to the map.

function add(eventType: "styleimagemissing", callback: (e: string) => void)

Parameters

eventType

"styleimagemissing"

The style image missing event name.

callback

(e: string) => void

The event handler callback.

add("styleselected", StyleControl, (e: string) => void)

Adds an event to the StyleControl

function add(eventType: "styleselected", target: StyleControl, callback: (e: string) => void)

Parameters

eventType

"styleselected"

The event name.

target
StyleControl

The StyleControl to add the event for.

callback

(e: string) => void

The event handler callback.

add("touchstart" | "touchend" | "touchmove" | "touchcancel", (e: MapTouchEvent) => void)

Adds a touch event to the map.

function add(eventType: "touchstart" | "touchend" | "touchmove" | "touchcancel", callback: (e: MapTouchEvent) => void)

Parameters

eventType

"touchstart" | "touchend" | "touchmove" | "touchcancel"

The touch event name.

callback

(e: MapTouchEvent) => void

The event handler callback.

add("touchstart" | "touchend" | "touchmove" | "touchcancel", Layer | Layer[], (e: MapTouchEvent) => void)

Adds a touch event to the Layer(s).

function add(eventType: "touchstart" | "touchend" | "touchmove" | "touchcancel", target: Layer | Layer[], callback: (e: MapTouchEvent) => void)

Parameters

eventType

"touchstart" | "touchend" | "touchmove" | "touchcancel"

The event name.

target

Layer | Layer[]

The Layer(s) to add the event for.

callback

(e: MapTouchEvent) => void

The event handler callback.

add("wheel", (e: MapMouseWheelEvent) => void)

Adds a wheel event to the map.

function add(eventType: "wheel", callback: (e: MapMouseWheelEvent) => void)

Parameters

eventType

"wheel"

The wheel event name.

callback

(e: MapMouseWheelEvent) => void

The event handler callback.

add("wheel", Layer | Layer[], (e: MapMouseWheelEvent) => void)

Adds a wheel event to the Layer(s).

function add(eventType: "wheel", target: Layer | Layer[], callback: (e: MapMouseWheelEvent) => void)

Parameters

eventType

"wheel"

The event name.

target

Layer | Layer[]

The Layer(s) to add the event for.

callback

(e: MapMouseWheelEvent) => void

The event handler callback.

addOnce("boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend", (e: MapEvent) => void)

Adds an event to the map.

function addOnce(eventType: "boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend", callback: (e: MapEvent) => void)

Parameters

eventType

"boxzoomstart" | "boxzoomend" | "dragstart" | "drag" | "dragend" | "idle" | "load" | "movestart" | "move" | "moveend" | "pitchstart" | "pitch" | "pitchend" | "ready" | "render" | "resize" | "rotatestart" | "rotate" | "rotateend" | "tokenacquired" | "zoomstart" | "zoom" | "zoomend"

The event name.

callback

(e: MapEvent) => void

The event handler callback.

addOnce("click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup", HtmlMarker, (e: TargetedEvent) => void)

Adds an event to the HtmlMarker.

function addOnce(eventType: "click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup", target: HtmlMarker, callback: (e: TargetedEvent) => void)

Parameters

eventType

"click" | "contextmenu" | "dblclick" | "drag" | "dragstart" | "dragend" | "keydown" | "keypress" | "keyup" | "mousedown" | "mouseenter" | "mouseleave" | "mousemove" | "mouseout" | "mouseover" | "mouseup"

The event name.

target
HtmlMarker

The HtmlMarker to add the event for.

callback

(e: TargetedEvent) => void

The event handler callback.

addOnce("data" | "sourcedata" | "styledata", (e: MapDataEvent) => void)

Adds a data event to the map.

function addOnce(eventType: "data" | "sourcedata" | "styledata", callback: (e: MapDataEvent) => void)

Parameters

eventType

"data" | "sourcedata" | "styledata"

The data event name.

callback

(e: MapDataEvent) => void

The event handler callback.

addOnce("dataadded" | "dataremoved", DataSource, (e: Shape[]) => void)

Adds an event to the DataSource.

function addOnce(eventType: "dataadded" | "dataremoved", target: DataSource, callback: (e: Shape[]) => void)

Parameters

eventType

"dataadded" | "dataremoved"

The event name.

target
DataSource

The DataSource to add the event for.

callback

(e: Shape[]) => void

The event handler callback.

addOnce("datasourceupdated", DataSource, (e: DataSource) => void)

Adds an event to the DataSource.

function addOnce(eventType: "datasourceupdated", target: DataSource, callback: (e: DataSource) => void)

Parameters

eventType

"datasourceupdated"

The event name.

target
DataSource

The DataSource to add the event for.

callback

(e: DataSource) => void

The event handler callback.

addOnce("drag" | "dragend" | "dragstart" | "open" | "close", Popup, (e: TargetedEvent) => void)

Adds an event to the Popup.

function addOnce(eventType: "drag" | "dragend" | "dragstart" | "open" | "close", target: Popup, callback: (e: TargetedEvent) => void)

Parameters

eventType

"drag" | "dragend" | "dragstart" | "open" | "close"

The event name.

target
Popup

The Popup to add the event for.

callback

(e: TargetedEvent) => void

The event handler callback.

addOnce("error", (e: MapErrorEvent) => void)

Adds an event to the map.

function addOnce(eventType: "error", callback: (e: MapErrorEvent) => void)

Parameters

eventType

"error"

The error event name.

callback

(e: MapErrorEvent) => void

The event handler callback.

addOnce("layeradded" | "layerremoved", (e: Layer) => void)

Adds an event to the map.

function addOnce(eventType: "layeradded" | "layerremoved", callback: (e: Layer) => void)

Parameters

eventType

"layeradded" | "layerremoved"

The event name.

callback

(e: Layer) => void

The event handler callback.

addOnce("layeradded" | "layerremoved", Layer, (e: Layer) => void)

Adds a touch event to the Layer.

function addOnce(eventType: "layeradded" | "layerremoved", target: Layer, callback: (e: Layer) => void)

Parameters

eventType

"layeradded" | "layerremoved"

The touch event name.

target
Layer

The Layer to add the event for.

callback

(e: Layer) => void

The event handler callback.

addOnce("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu", (e: MapMouseEvent) => void)

Adds a mouse event to the map.

function addOnce(eventType: "mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu", callback: (e: MapMouseEvent) => void)

Parameters

eventType

"mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "contextmenu"

The mouse event name.

callback

(e: MapMouseEvent) => void

The event handler callback.

addOnce("mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu", Layer, (e: MapMouseEvent) => void)

Adds a mouse event to the Layer.

function addOnce(eventType: "mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu", target: Layer, callback: (e: MapMouseEvent) => void)

Parameters

eventType

"mousedown" | "mouseup" | "mouseover" | "mousemove" | "click" | "dblclick" | "mouseout" | "mouseenter" | "mouseleave" | "contextmenu"

The mouse event name.

target
Layer

The Layer to add the event for.

callback

(e: MapMouseEvent) => void

The event handler callback.

addOnce("shapechanged", Shape, (e: Shape) => void)

Adds an event to the Shape.

function addOnce(eventType: "shapechanged", target: Shape, callback: (e: Shape) => void)

Parameters

eventType

"shapechanged"

The event name.

target
Shape

The Shape to add the event for.

callback

(e: Shape) => void

The event handler callback.

addOnce("sourceadded" | "sourceremoved", (e: Source) => void)

Adds an event to the map.

function addOnce(eventType: "sourceadded" | "sourceremoved", callback: (e: Source) => void)

Parameters

eventType

"sourceadded" | "sourceremoved"

The event name.

callback

(e: Source) => void

The event handler callback.

addOnce("sourceadded" | "sourceremoved", Source, (e: Source) => void)

Adds an event to the Source.

function addOnce(eventType: "sourceadded" | "sourceremoved", target: Source, callback: (e: Source) => void)

Parameters

eventType

"sourceadded" | "sourceremoved"

The event name.

target
Source

The Source to add the event for.

callback

(e: Source) => void

The event handler callback.

addOnce("stylechanged", (e: StyleChangedEvent) => void)

Adds a wheel event to the map.

function addOnce(eventType: "stylechanged", callback: (e: StyleChangedEvent) => void)

Parameters

eventType

"stylechanged"

The wheel event name.

callback

(e: StyleChangedEvent) => void

The event handler callback.

addOnce("styleimagemissing", (e: string) => void)

Adds a style image missing event to the map.

function addOnce(eventType: "styleimagemissing", callback: (e: string) => void)

Parameters

eventType

"styleimagemissing"

The style image missing event name.

callback

(e: string) => void

The event handler callback.

addOnce("styleselected", StyleControl, (e: string) => void)

Adds an event to the StyleControl

function addOnce(eventType: "styleselected", target: StyleControl, callback: (e: string) => void)

Parameters

eventType

"styleselected"

The event name.

target
StyleControl

The StyleControl to add the event for.

callback

(e: string) => void

The event handler callback.

addOnce("touchstart" | "touchend" | "touchmove" | "touchcancel", (e: MapTouchEvent) => void)

Adds a touch event to the map.

function addOnce(eventType: "touchstart" | "touchend" | "touchmove" | "touchcancel", callback: (e: MapTouchEvent) => void)

Parameters

eventType

"touchstart" | "touchend" | "touchmove" | "touchcancel"

The touch event name.

callback

(e: MapTouchEvent) => void

The event handler callback.

addOnce("touchstart" | "touchend" | "touchmove" | "touchcancel", Layer, (e: MapTouchEvent) => void)

Adds a touch event to the Layer.

function addOnce(eventType: "touchstart" | "touchend" | "touchmove" | "touchcancel", target: Layer, callback: (e: MapTouchEvent) => void)

Parameters

eventType

"touchstart" | "touchend" | "touchmove" | "touchcancel"

The touch event name.

target
Layer

The Layer to add the event for.

callback

(e: MapTouchEvent) => void

The event handler callback.

addOnce("wheel", (e: MapMouseWheelEvent) => void)

Adds a wheel event to the map.

function addOnce(eventType: "wheel", callback: (e: MapMouseWheelEvent) => void)

Parameters

eventType

"wheel"

The wheel event name.

callback

(e: MapMouseWheelEvent) => void

The event handler callback.

addOnce("wheel", Layer, (e: MapMouseWheelEvent) => void)

Adds a wheel event to the Layer.

function addOnce(eventType: "wheel", target: Layer, callback: (e: MapMouseWheelEvent) => void)

Parameters

eventType

"wheel"

The wheel event name.

target
Layer

The Layer to add the event for.

callback

(e: MapMouseWheelEvent) => void

The event handler callback.

invoke(string, any)

Invokes an event on the map. This causes all event handlers on the map with the specified event name to be called.

function invoke(eventType: string, args: any): any

Parameters

eventType

string

The name of the event to invoke.

args

any

The data to be passed to the callbacks.

Returns

any

invoke(string, any, any)

Invokes an event of the target. This causes all event handlers on the target with the specified event name to be called.

function invoke(eventType: string, target: any, args: any): any

Parameters

eventType

string

The name of the event to invoke.

target

any

The target to invoke the event on. Supported target types are Layer, HtmlMarker, and Popup.

args

any

The data to be passed to the callbacks. The data can be null but cannot be undefined.

Returns

any

remove(string, (e: void | Layer | MapEvent | MapDataEvent | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Source | string | MapConfiguration) => void)

Removes an event listener from the map.

function remove(eventType: string, callback: (e: void | Layer | MapEvent | MapDataEvent | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Source | string | MapConfiguration) => void)

Parameters

eventType

string

The event name.

callback

(e: void | Layer | MapEvent | MapDataEvent | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Source | string | MapConfiguration) => void

The event handler callback.

remove(string, DataSource | DataSource[], (e: DataSource | Shape[]) => void)

Removes an event listener from the DataSource(s).

function remove(eventType: string, target: DataSource | DataSource[], callback: (e: DataSource | Shape[]) => void)

Parameters

eventType

string

The event name.

target

DataSource | DataSource[]

The DataSource(s) to remove the event for.

callback

(e: DataSource | Shape[]) => void

The event handler callback.

remove(string, HtmlMarker | HtmlMarker[], (e: TargetedEvent) => void)

Removes an event listener from the HtmlMarker(s).

function remove(eventType: string, target: HtmlMarker | HtmlMarker[], callback: (e: TargetedEvent) => void)

Parameters

eventType

string

The event name.

target

HtmlMarker | HtmlMarker[]

The HtmlMarker(s) to remove the event for.

callback

(e: TargetedEvent) => void

The event handler callback.

remove(string, Layer | Layer[], (e: void | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Layer) => void)

Removes an event listener from the Layer(s).

function remove(eventType: string, target: Layer | Layer[], callback: (e: void | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Layer) => void)

Parameters

eventType

string

The event name.

target

Layer | Layer[]

The Layer(s) to remove the event for.

callback

(e: void | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | Layer) => void

The event handler callback.

remove(string, Popup | Popup[], (e: TargetedEvent) => void)

Removes an event listener from the Popup(s).

function remove(eventType: string, target: Popup | Popup[], callback: (e: TargetedEvent) => void)

Parameters

eventType

string

The event name.

target

Popup | Popup[]

The Popup(s) to remove the event for.

callback

(e: TargetedEvent) => void

The event handler callback.

remove(string, Shape | Shape[], (e: Shape) => void)

Removes an event listener from the Shape(s).

function remove(eventType: string, target: Shape | Shape[], callback: (e: Shape) => void)

Parameters

eventType

string

The event name.

target

Shape | Shape[]

The Shapes(s) to remove the event for.

callback

(e: Shape) => void

The event handler callback.

remove(string, Source | Source[], (e: Source) => void)

Removes an event listener from the Source(s).

function remove(eventType: string, target: Source | Source[], callback: (e: Source) => void)

Parameters

eventType

string

The event name.

target

Source | Source[]

The Source(s) to remove the event for.

callback

(e: Source) => void

The event handler callback.

remove(string, StyleControl, (e: string) => void)

Removes an event to the StyleControl

function remove(eventType: string, target: StyleControl, callback: (e: string) => void)

Parameters

eventType

string

The event name.

target
StyleControl

The StyleControl to add the event for.

callback

(e: string) => void

The event handler callback.