[]previous and next page

createHashHistory

A history over the URL fragment (#/a/b), for hosts that cannot change the path.

A history over the URL fragment (#/a/b), for hosts that cannot change the path.

Import#

ts
import { createHashHistory } from "@shadow-js/router";

Signature#

ts
function createHashHistory(win: WindowLike, options: HistoryOptions = {}): BrowserHistory

Parameters#

Name Description
win Window-like object; tests pass a fake.
options Flush scheduler.

Returns#

A hash history.

Examples#

ts
import { createHashHistory } from "@shadow-js/router/core";
const history = createHashHistory(window);
history.push("/posts/7"); // the URL fragment becomes "#/posts/7"