The translation was generated automatically and may contain mistakes

History of Navigation

Use an object to track transition histories HistoryManager from the library vk-mini-apps-router . It contains methods to access the transition history and the current position in that history.

Method
Description
Returns the current position in the history stack.
Returns the stack of history — ViewNavigationRecord .

Example

To obtain an object HistoryManager Call the function useHistoryManager() .

TypeScript
import { useHistoryManager, useRouteNavigator } from '@vkontakte/vk-mini-apps-router'; export function SomePage() { const historyManager = useHistoryManager(); const routeNavigator = useRouteNavigator(); const currentPosition = historyManager.getCurrentPosition(); const historyStack = historyManager.getHistory(); return ( ... ); }

ViewNavigationRecord

The history of transitions consists of records ViewNavigationRecord . Object ViewNavigationRecord It contains the following properties:

Property
Type
Description
position
number
Record number.
locationKey
string
A unique transition identifier.
path
string
path of recording.
state
object
Status of the router.
view
string
Current view .
panel
string
Current panel .
root Unnecessary
string
Current root .
tab Unnecessary
string
Current tab .
modal Unnecessary
string
Current modal .
popout Unnecessary
string
Current popout .

Materials on the topic