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:
@@ -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)
|
||||
})
|
||||
})
|
||||
}
|
||||
}())
|
||||
Reference in New Issue
Block a user