* Add demo

* Fix stuff

* Lint

* Typescript and demo card

* More fixes

* Allow switching through configs

* Lint

* Lint2

* Add two demo configs

* Lint

* Lint
This commit is contained in:
Paulus Schoutsen
2019-01-18 21:24:32 -08:00
committed by GitHub
parent 65359aabe3
commit bb71fe0bec
84 changed files with 26510 additions and 1087 deletions

View File

@@ -5,10 +5,18 @@ export const navigate = (
path: string,
replace: boolean = false
) => {
if (replace) {
history.replaceState(null, "", path);
if (__DEMO__) {
if (replace) {
history.replaceState(null, "", `${location.pathname}#${path}`);
} else {
window.location.hash = path;
}
} else {
history.pushState(null, "", path);
if (replace) {
history.replaceState(null, "", path);
} else {
history.pushState(null, "", path);
}
}
fireEvent(node, "location-changed");
};