2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

Register a service worker.

This commit is contained in:
XhmikosR
2017-07-16 16:54:09 +03:00
parent e9323459ab
commit 20abbc3c16
4 changed files with 18 additions and 1 deletions
+15
View File
@@ -0,0 +1,15 @@
/* eslint no-console:off */
(function setupSW() {
'use strict'
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/sw.js').then(function (registration) {
console.log('ServiceWorker registration successful with scope: ', registration.scope)
}).catch(function (err) {
console.log('ServiceWorker registration failed: ', err)
})
})
}
}())