mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 10:59:50 +00:00
23 lines
480 B
TypeScript
23 lines
480 B
TypeScript
import { fireEvent } from "./dom/fire_event";
|
|
|
|
export const navigate = (
|
|
_node: any,
|
|
path: string,
|
|
replace: boolean = false
|
|
) => {
|
|
if (__DEMO__) {
|
|
if (replace) {
|
|
history.replaceState(null, "", `${location.pathname}#${path}`);
|
|
} else {
|
|
window.location.hash = path;
|
|
}
|
|
} else {
|
|
if (replace) {
|
|
history.replaceState(null, "", path);
|
|
} else {
|
|
history.pushState(null, "", path);
|
|
}
|
|
}
|
|
fireEvent(window, "location-changed");
|
|
};
|