Skip to main content

DomMarkerLayer

wemap-sdk-js


Class: DomMarkerLayer

Manages runtime DOM markers on the map (destination pins, annotations, waypoints).

WemapMap.remove() does not destroy this layer — call destroy explicitly.

Constructors

Constructor

new DomMarkerLayer(wemapMap, options?): DomMarkerLayer

Parameters

wemapMap

WemapMap

options?

DomMarkerLayerOptions = {}

Returns

DomMarkerLayer

Methods

add()

add(options): void

Add or update a marker by id. Invalid position throws.

Parameters

options

DomMarkerAddOptions

Returns

void


destroy()

destroy(): void

Remove all markers and detach listeners. Idempotent.

Returns

void


on()

Call Signature

on(event, handler): () => void

Subscribe to DOM marker clicks. Returns an unsubscribe function.

Parameters
event

"click"

handler

(event) => void

Returns

() => void

Call Signature

on(event, handler): () => void

Subscribe to DOM marker clicks. Returns an unsubscribe function.

Parameters
event

"clusterclick"

handler

(event) => void

Returns

() => void


remove()

remove(id): void

Remove a marker by id. Unknown id is a no-op.

Parameters

id

string

Returns

void


setClusterEnabled()

setClusterEnabled(enabled): void

Toggle clustering at runtime. No-op when the layer was created without cluster options.

Parameters

enabled

boolean

Returns

void


setMarkers()

setMarkers(descriptors): void

Reconcile the layer to exactly descriptors: add markers for new ids, update markers already present (by id, via add), and remove markers whose id is absent. The add/remove diff callers used to hand-roll lives here now — pass the full desired set on every change and let the layer settle to it.

Parameters

descriptors

DomMarkerAddOptions[]

Returns

void