custom-card-helpers
Version:
Set of helpful functions and types for Custom Card creators
26 lines (23 loc) • 438 B
text/typescript
import { fireEvent } from "./fire-event";
declare global {
// for fire event
interface HASSDomEvents {
"location-changed": {
replace: boolean;
};
}
}
export const navigate = (
_node: any,
path: string,
replace: boolean = false
) => {
if (replace) {
history.replaceState(null, "", path);
} else {
history.pushState(null, "", path);
}
fireEvent(window, "location-changed", {
replace
});
};