Skip to content

Commit 50c7b8a

Browse files
committed
Fixes service worker caching issue with unregister function
1 parent 194e832 commit 50c7b8a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/includes/base.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,19 @@
2727
menuToggle.setAttribute('aria-expanded', newExpandedState.toString());
2828
});
2929
};
30+
31+
function unregister() {
32+
if ('serviceWorker' in navigator) {
33+
navigator.serviceWorker.ready
34+
.then((registration) => {
35+
registration.unregister();
36+
})
37+
.catch((error) => {
38+
console.error(error.message);
39+
});
40+
}
41+
}
42+
43+
// unregister any existing service workers
44+
unregister();
3045
})();

0 commit comments

Comments
 (0)