123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- importScripts("/dist/precache-manifest.493a34bea0fcd06ff63f97238a050ffa.js");
- var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
- workbox.core.setCacheNameDetails({ prefix: 'MeeChat' })
- /**
- * 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, {
- directoryIndex: null
- })
- // // 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/')
- // // )
- // })
|