Navigation events

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 WebB2C WebB2C 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:
Event data:
FieldTypeDescription
titlestring | nullTitle of the current navigation state
stateunknownArbitrary state passed by the mini-app during push/replace
Subscription example:
typescript
import 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.
The event carries no additional data.
Subscription example:
typescript
import bridge from '@open-condo/bridge' bridge.subscribe((event) => { if (event.type === 'CondoWebAppBackButtonEvent') { console.log('User tapped the Back button') } })