History


How to use the History class of the bit Butil?

Usage
To use the browser history features you need to inject the Bit.Butil.History class and use it like this:
@inject Bit.Butil.History history

@code {
    await history.GoBack();
}
Methods

GetLength:
Returns an Integer representing the number of elements in the session history, including the currently loaded page (MDN).



SetScrollRestoration, GetScrollRestoration:
Gets/Sets default scroll restoration behavior on history navigation. This property can be either auto or manual (MDN).



GetState: Returns an any value representing the state at the top of the history stack (MDN).

GoBack:
This asynchronous method goes to the previous page in session history, the same action as when the user clicks the browser's Back button. Calling this method to go back beyond the first page in the session history has no effect and doesn't raise an exception (MDN).



GoForward:
This asynchronous method goes to the next page in session history, the same action as when the user clicks the browser's Forward button. Calling this method to go forward beyond the most recent page in the session history has no effect and doesn't raise an exception (MDN).



Go:
Asynchronously loads a page from the session history, identified by its relative location to the current page, for example -1 for the previous page or 1 for the next page. Calling this method without parameters or a value of 0 reloads the current page (MDN).



PushState:
Pushes the given data onto the session history stack with the specified title (and, if provided, URL) (MDN).



ReplaceState:
Updates the most recent entry on the history stack to have the specified data, title, and, if provided, URL (MDN).



AddPopState, RemovePopState:
The popstate event of the Window interface is fired when the active history entry changes while the user navigates the session history (MDN).