Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Establish Service WalkerRules #227

Merged
merged 7 commits into from Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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