mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-29 05:28:53 +03:00
Fix: Establish Service WalkerRules (#227)
This commit is contained in:
parent
6535ac5626
commit
04971dcf87
2 changed files with 16 additions and 2 deletions
14
src/App.vue
14
src/App.vue
|
@ -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()
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue