12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- importScripts("/dist/precache-manifest.bc544114b650b56c350c6ee44b252be7.js");
- /**
- * Welcome to your Workbox-powered service worker!
- *
- * You'll need to register this file in your web app and you should
- * disable HTTP caching for this file too.
- * See https://goo.gl/nhQhGp
- *
- * The rest of the code is auto-generated. Please don't update this file
- * directly; instead, make changes to your Workbox build configuration
- * and re-run your build process.
- * See https://goo.gl/2aRDsh
- */
- importScripts('/dist/workbox-sw.js')
- workbox.core.setCacheNameDetails({ prefix: 'eos-chat' })
- /**
- * The workboxSW.precacheAndRoute() method efficiently caches and responds to
- * requests for URLs in the manifest.
- * See https://goo.gl/S9QRab
- */
- self.__precacheManifest = [].concat(self.__precacheManifest || [])
- workbox.precaching.suppressWarnings()
- workbox.precaching.precacheAndRoute(self.__precacheManifest, {})
- // // const CACHE_NAME = 'mySiteCache';
- // // let urlsToCache = [
- // // '/',
- // // ];
- // self.addEventListener('install', function (event) {
- // console.log('[ServiceWorker] install')
- // // event.waitUntil(
- // // caches.open(CACHE_NAME).then(function(caches){
- // // console.log('open cache');
- // // return caches.addAll(urlsToCache);
- // // })
- // // )
- // })
- // self.addEventListener('activate', function (event) {
- // console.log('[ServiceWorker] activate')
- // // const cacheWhitelist = ['pagesCache', 'blogPostsCache'];
- // // event.waitUntil(
- // // caches.keys().then(function(cacheNames) {
- // // return Promise.all(
- // // cacheNames.map(function(cacheName) {
- // // if (cacheWhitelist.indexOf(cacheName) === -1) {
- // // return caches.delete(cacheName);
- // // }
- // // })
- // // );
- // // })
- // // );
- // })
- // self.addEventListener('fetch', function (event) {
- // console.log('[ServiceWorker] Fetch', event.request.url)
- // })
- // self.addEventListener('error', function (event) {
- // console.log('[ServiceWorker] error', event)
- // })
- // self.addEventListener('push', function (event) {
- // // console.log('[Service Worker] 收到通知',event);
- // console.log(`[Service Worker] 收到的通知数据为: "${event.data.text()}"`)
- // function decodeUnicode (str) {
- // str = str.replace(/\\/g, '%')
- // str = unescape(str)
- // str = str.replace(/%/g, '\\')
- // str = str.replace(/\\/g, '')
- // return str
- // }
- // let data = JSON.parse(event.data.text())
- // const title = decodeUnicode(data.title)
- // const options = {
- // body: decodeUnicode(data.content),
- // icon: 'dice-logo.png'
- // }
- // event.waitUntil(self.registration.showNotification(title, options))
- // })
- // // 点击跳转
- // self.addEventListener('notificationclick', function (event) {
- // event.notification.close()
- // // event.waitUntil(
- // // clients.openWindow('https://dice.eosget.io/')
- // // )
- // })
|