Fix: Establish Service WalkerRules (#227)

This commit is contained in:
m4ximuel 2021-04-19 19:56:49 +09:00 committed by GitHub
parent 6535ac5626
commit 04971dcf87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -34,6 +34,20 @@ export default {
}
},
created() {
self.addEventListener('fetch', function (event) {
event.respondWith(async function () {
try {
var res = await fetch(event.request)
var cache = await caches.open('cache')
cache.put(event.request.url, res.clone())
return res
} catch (error) {
return caches.match(event.request)
}
}())
})
this.$store.commit('SET_APP_VERSION', process.env['APPLICATION_VERSION'])
this.checkDeviceDarkTheme()
this.checkAuthenticated()

View file

@ -21,9 +21,9 @@ if (process.env.NODE_ENV === 'production') {
},
updated() {
console.log('New content is available; please refresh.')
caches.keys().then(function (names) {
/*caches.keys().then(function (names) {
for (const name of names) caches.delete(name)
})
})*/
},
offline() {
console.log(