mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 02:49:51 +00:00
Extract navigate mixin (#1865)
* Extract navigate to function * Remove eventsmixin properly and side effects
This commit is contained in:
14
src/common/navigate.ts
Normal file
14
src/common/navigate.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { fireEvent } from "./dom/fire_event.js";
|
||||
|
||||
export const navigate = (
|
||||
node: HTMLElement,
|
||||
path: string,
|
||||
replace: boolean = false
|
||||
) => {
|
||||
if (replace) {
|
||||
history.replaceState(null, "", path);
|
||||
} else {
|
||||
history.pushState(null, "", path);
|
||||
}
|
||||
fireEvent(node, "location-changed");
|
||||
};
|
||||
Reference in New Issue
Block a user