CliveNi
2024-04-07 3d812b10e9332b7d0d4619a87c8d8ac5afb878c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* eslint no-console:off */
 
(function () {
  'use strict'
 
  if ('serviceWorker' in navigator) {
    window.addEventListener('load', function () {
      navigator.serviceWorker.register('/sw.js').then(function (registration) { // eslint-disable-line compat/compat
        console.log('ServiceWorker registration successful with scope: ', registration.scope)
      }).catch(function (err) {
        console.log('ServiceWorker registration failed: ', err)
      })
    })
  } else {
    console.log('Service workers are not supported.')
  }
}())