mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Caching service workera
This commit is contained in:
@@ -5,28 +5,25 @@ import { register } from 'register-service-worker'
|
|||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
register(`${process.env.BASE_URL}service-worker.js`, {
|
register(`${process.env.BASE_URL}service-worker.js`, {
|
||||||
ready () {
|
ready () {
|
||||||
console.log(
|
console.log('SW gotowy')
|
||||||
'App is being served from cache by a service worker.\n' +
|
|
||||||
'For more details, visit https://goo.gl/AFskqB'
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
registered () {
|
registered () {
|
||||||
console.log('Service worker has been registered.')
|
console.log('SW: zarejestrowano')
|
||||||
},
|
},
|
||||||
cached () {
|
cached () {
|
||||||
console.log('Content has been cached for offline use.')
|
console.log('SW: cached')
|
||||||
},
|
},
|
||||||
updatefound () {
|
updatefound () {
|
||||||
console.log('New content is downloading.')
|
console.log('SW: aktualizacja danych')
|
||||||
},
|
},
|
||||||
updated () {
|
updated () {
|
||||||
console.log('New content is available; please refresh.')
|
console.log('SW: zaktualizowano dane');
|
||||||
},
|
},
|
||||||
offline () {
|
offline () {
|
||||||
console.log('No internet connection found. App is running in offline mode.')
|
console.log('SW: tryb offline')
|
||||||
},
|
},
|
||||||
error (error) {
|
error (error) {
|
||||||
console.error('Error during service worker registration:', error)
|
console.error('SW: wystąpił błąd - ', error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
pwa: {
|
||||||
|
workboxOptions: {
|
||||||
|
skipWaiting: true,
|
||||||
|
clientsClaim: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user