On some Condo surfaces, a mini-app can manage its state and navigation using an API similar to the browser's window.history
Three methods are available for navigation: PushHistoryState, ReplaceHistoryState and PopHistoryState.
Platforms
| B2B Web | B2C Web | B2C Cordova |
|---|---|---|
Events
During navigation, a mini-app can receive two incoming events.
CondoWebAppHistoryPopStateEvent
This event contains the current navigation state — the title and an arbitrary state previously passed by the mini-app.
The event is fired in the following cases:
- after calling PushHistoryState, ReplaceHistoryState or PopHistoryState
- when the Back navigation button is triggered (since it automatically calls PopHistoryState)
Event data:
| Field | Type | Description |
|---|---|---|
| title | string | null | Title of the current navigation state |
| state | unknown | Arbitrary state passed by the mini-app during push/replace |
Subscription example:
typescriptimport bridge from '@open-condo/bridge' bridge.subscribe((event) => { if (event.type === 'CondoWebAppHistoryPopStateEvent') { const { title, state } = event.data console.log('Current navigation state:', title, state) } })
CondoWebAppBackButtonEvent
This event is fired when the user taps the Back navigation button.
If the mini-app navigation stack is not empty,
CondoWebAppHistoryPopStateEvent is automatically fired alongside CondoWebAppBackButtonEvent with the state at the top of the stack.The event carries no additional data.
Subscription example:
typescriptimport bridge from '@open-condo/bridge' bridge.subscribe((event) => { if (event.type === 'CondoWebAppBackButtonEvent') { console.log('User tapped the Back button') } })