Skip to content

Commit

Permalink
Change the SW clean-up
Browse files Browse the repository at this point in the history
We can just remove the SW for our scope.
  • Loading branch information
microbit-matt-hillsdon committed May 29, 2024
1 parent 9d81538 commit 8d05414
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ if ("serviceWorker" in navigator) {
if (flags.sw) {
initServiceWorker();
} else {
navigator.serviceWorker.getRegistrations().then((registrations) => {
if (registrations.length > 0) {
// We should only have one service worker to unregister.
registrations[0].unregister().then(() => {
window.location.reload();
});
}
navigator.serviceWorker.getRegistration().then((registration) => {
registration?.unregister().then(() => {
window.location.reload();
});
});
}
}
Expand Down

0 comments on commit 8d05414

Please sign in to comment.