Register the Service Worker

This commit is contained in:
Serdar KÖKTAŞ 2020-01-12 23:31:11 +03:00
parent 794ef99609
commit ced64485ad
1 changed files with 16 additions and 1 deletions

View File

@ -28,3 +28,18 @@
{{ end }} {{ end }}
</div> </div>
</footer> </footer>
<script>
if('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/sw.js', { scope: '/' })
.then(function(registration) {
console.log('Service Worker Registered');
});
navigator.serviceWorker
.ready
.then(function(registration) {
console.log('Service Worker Ready');
});
}
</script>