Skip to content

Commit 07b1ed7

Browse files
Change the SW clean-up (#116)
We can just remove the SW for our scope.
1 parent 9d81538 commit 07b1ed7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/simulator.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,10 @@ if ("serviceWorker" in navigator) {
4747
if (flags.sw) {
4848
initServiceWorker();
4949
} else {
50-
navigator.serviceWorker.getRegistrations().then((registrations) => {
51-
if (registrations.length > 0) {
52-
// We should only have one service worker to unregister.
53-
registrations[0].unregister().then(() => {
54-
window.location.reload();
55-
});
56-
}
50+
navigator.serviceWorker.getRegistration().then((registration) => {
51+
registration?.unregister().then(() => {
52+
window.location.reload();
53+
});
5754
});
5855
}
5956
}

0 commit comments

Comments
 (0)