Skip to content

Interface: MapInstance

Opaque reference representing a running map instance. Returned by init(). The Mapsted Maps JavaScript API is module-scoped (single map per page); MapInstance provides a handle for destroy() and state queries.

Methods

destroy()

ts
destroy(): Promise<void>;

Destroy this map instance, removing the iframe and clearing all state.

Returns

Promise<void>


getState()

ts
getState(): Promise<MapState>;

Get a snapshot of the current state.

Returns

Promise<MapState>


isReady()

ts
isReady(): Promise<boolean>;

Check if this map instance is ready for commands.

Returns

Promise<boolean>


subscribe()

ts
subscribe(handler): Unsubscribe;

Subscribe to state changes. Returns an unsubscribe function.

Parameters

ParameterType
handler(state) => void

Returns

Unsubscribe