Events
Map → you: subscribe with map.on(event, handler). Check meta.source === "user" when you only want visitor-driven changes.
map.on() infers payload types from the event name and manages opt-in subscriptions for high-frequency events like camera.changed.
| Event | When |
|---|---|
selection.changed | Building, floor, or room changed |
directions.changed | Route started, updated, or cleared |
state.changed | Any state change — catch-all resync |
camera.idle | Camera motion finished |
expand.requested | Visitor asked to open the full map |
const off = map.on("selection.changed", (payload, meta) => {
console.log(payload.room, meta.source);
});
off();
Wire event names
Full catalog in the protocol events reference:
map.ready, map.loaded, map.error, state.changed, selection.changed, directions.changed, expand.requested, camera.changed, camera.idle, camera.pathEnded