Skip to content

Function: once()

Call Signature

ts
function once<E>(event, handler): Unsubscribe;

Subscribe to a known event, firing the handler at most once.

Type Parameters

Type Parameter
E extends | "all" | "select" | "load" | "coordsSelect" | "floorChange" | "idleChange" | "mapOverlayMarkerSelect" | "zoomLevelChange" | "mapCenterChange" | "promotionClick" | "navigationStart" | "searchText" | "detailsView" | "promotionDetails" | "accessibilityChange" | "boostComplete" | "mapMounted" | "themeChange" | "protocolError" | "mapClosed" | "poiOfferShown" | "mapLoadTime" | "stepDirectionViewed" | "similarPoiSuggested" | "similarPoiClicked" | "searchVoiceUsed" | "searchByCategory" | "recommendationClicked" | "recommendationTriggered" | "terminalSelected" | "multiPointRouteInitiated" | "buildingChange"

Parameters

ParameterType
eventE
handler(payload) => void

Returns

Unsubscribe

Call Signature

ts
function once(event, handler): Unsubscribe;

Catch-all overload — subscribe to any event string (including custom or future events not yet in KnownEventName) firing the handler at most once. The payload arrives as unknown; narrow with a type guard as needed. Prefer the typed overload above for known event names — TypeScript will infer the correct payload type automatically.

Parameters

ParameterType
eventstring
handler(payload) => void

Returns

Unsubscribe