The state read-only property of the History interface returns a value representing the state at the top of the history stack. This is a way to look at the state without having to wait for a Window.popstate_event event.
state
Window.popstate_event
external JSAny? get state;