Update @material/web ti 1.0.0-pre.13

add Listener to hashchange event
This commit is contained in:
2023-07-22 12:33:09 +08:00
parent 025bbc0a3b
commit 12d64ae9ca
2 changed files with 9 additions and 1 deletions

View File

@@ -24,7 +24,7 @@
"pbkdf2-hmac": "https://esm.sh/[email protected]",
"pbkdf2-hmac/": "https://esm.sh/[email protected]/",
"randomstring": "https://esm.sh/[email protected]",
"@material/web/": "https://unpkg.lifegpc.workers.dev/@material/[email protected]2/",
"@material/web/": "https://unpkg.lifegpc.workers.dev/@material/[email protected]3/",
"@lit-labs/react/": "https://esm.sh/@lit-labs/[email protected]/"
}
}

View File

@@ -20,6 +20,14 @@ export function initState(l: StateUpdater<string>) {
l("#/");
}
});
self.addEventListener("hashchange", (_) => {
const hash = document.location.hash;
if (!hash || hash == "#") {
l("#/");
} else {
l(hash);
}
});
}
export const set_state: StateUpdater<string> = (updater) => {