mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-11 22:23:32 +08:00
updating service worker after register
unregistering other service workers
This commit is contained in:
parent
8710581f4b
commit
10a5633e25
1 changed files with 11 additions and 1 deletions
|
@ -89,7 +89,17 @@
|
|||
></script>
|
||||
<script>
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("sw.js");
|
||||
navigator.serviceWorker
|
||||
.getRegistrations()
|
||||
.then(function (registrations) {
|
||||
for (let registration of registrations) {
|
||||
if (registration.scope !== "https://monkeytype.com/")
|
||||
registration.unregister();
|
||||
}
|
||||
});
|
||||
navigator.serviceWorker.register("sw.js").then((reg) => {
|
||||
reg.update();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue