Skip to content

Commit

Permalink
feat: 自动卸载sw
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon committed Aug 28, 2024
1 parent dad4c32 commit 93ed2d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,14 @@

<% if (theme.service_worker.enable) { %>
<%- js('js/service_worker.js') %>
<% } else { %>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (let registration of registrations) {
registration.unregister();
}
});
}
</script>
<% } %>

0 comments on commit 93ed2d9

Please sign in to comment.