createBrowserHistory
A history over window.history with paths (/a/b).
A history over window.history with paths (/a/b).
Import#
ts
import { createBrowserHistory } from "@shadow-js/router";
Signature#
ts
function createBrowserHistory(
win: WindowLike,
options: HistoryOptions = {},
): BrowserHistory
Parameters#
| Name | Description |
|---|---|
win |
Window-like object; tests pass a fake. |
options |
Flush scheduler. |
Returns#
A browser history. Call destroy() to remove the popstate listener.
Examples#
ts
import { createBrowserHistory } from "@shadow-js/router/core";
const history = createBrowserHistory(window);
history.push("/posts/7");
history.destroy(); // removes the popstate listener