Skip to content

Commit

Permalink
feat: add Service Worker support
Browse files Browse the repository at this point in the history
  • Loading branch information
reuixiy committed Aug 12, 2019
1 parent 8aa27f0 commit 76ba288
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions layouts/partials/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,14 @@
{{ partial "third-party/disqus.html" . }}
{{ end }}
{{ end }}
{{ end }}

{{ if .Site.Params.enableServiceWorker }}
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js');
});
}
</script>
{{ end }}

0 comments on commit 76ba288

Please sign in to comment.