For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Type Alias MapEventSDK<T>

MapEventSDK: MapEventTypeSDK[T] & object & { target: Map }

An event as an SDK Map listener receives it. MapLibre types its events' target as its own Map, which lacks the SDK members, but the target is always the SDK Map that fired it.

The target is intersected in, rather than remapped over every event, so the SDK Map's on/once/off stay assignable to MapLibre's — the SDK Map is passed to MapLibre controls and layers.

Type Parameters

const onClick = (e: MapEventSDK<"click">) => console.log(e.lngLat, e.target.getSpace());
map.on("click", onClick);
Was this helpful?