Skip to content

Commit

Permalink
♻️ Remove service worker in template
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 20, 2020
1 parent fc81dc9 commit eda619a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,25 @@
</head>
<body>
<div id="sapper">%sapper.html%</div>
<script>
try {
if (typeof window !== "undefined" && window.navigator && navigator.serviceWorker) {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
registration.unregister();
}
});
}
if (typeof window !== "undefined" && "caches" in window) {
caches.keys().then(function (keyList) {
return Promise.all(
keyList.map(function (key) {
return caches.delete(key);
})
);
});
}
} catch (error) {}
</script>
</body>
</html>

0 comments on commit eda619a

Please sign in to comment.