Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix: Establish Service WalkerRules (#227)
  • Loading branch information
m4ximuel committed Apr 19, 2021
1 parent 6535ac5 commit 04971dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/App.vue
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/registerServiceWorker.js
Expand Up @@ -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(
Expand Down

0 comments on commit 04971dc

Please sign in to comment.