Navigate cleanup (#9202)

This commit is contained in:
Joakim Sørensen
2021-05-25 17:46:36 +02:00
committed by GitHub
parent 1026e90296
commit 21a3a8c594
62 changed files with 111 additions and 137 deletions

View File

@@ -4,13 +4,17 @@ import { mainWindow } from "./dom/get_main_window";
declare global {
// for fire event
interface HASSDomEvents {
"location-changed": {
replace: boolean;
};
"location-changed": NavigateOptions;
}
}
export const navigate = (_node: any, path: string, replace = false) => {
export interface NavigateOptions {
replace?: boolean;
}
export const navigate = (path: string, options?: NavigateOptions) => {
const replace = options?.replace || false;
if (__DEMO__) {
if (replace) {
mainWindow.history.replaceState(