Appearance
Function: subscribe()
ts
function subscribe(handler): Unsubscribe;Subscribe to Mapsted Maps JavaScript API state changes. Callable pre-init — subscribers receive LOADING → READY transitions during init. This is documented behavior.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | (state) => void | Callback invoked on every state change. Receives the full MapState snapshot. Type: (state: MapState) => void. |
Returns
An Unsubscribe function — call it to detach the handler.
Throws
MAPSTED-1091 when handler is not a function.