2018-10-12 16:42:54 +02:00
|
|
|
/*
|
|
|
|
|
* This file is picked up by the build system only
|
|
|
|
|
* when building for PRODUCTION
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import {register} from 'register-service-worker'
|
|
|
|
|
|
|
|
|
|
register(process.env.SERVICE_WORKER_FILE, {
|
|
|
|
|
ready() {
|
|
|
|
|
console.log('READY::: App is being served from cache by a service worker.')
|
2019-01-31 13:52:52 +01:00
|
|
|
|
2018-10-12 16:42:54 +02:00
|
|
|
},
|
|
|
|
|
registered(registration) { // registration -> a ServiceWorkerRegistration instance
|
2019-01-31 13:52:52 +01:00
|
|
|
console.log('REGISTERED::: !!!', process.env.SERVICE_WORKER_FILE)
|
|
|
|
|
|
2018-10-12 16:42:54 +02:00
|
|
|
},
|
|
|
|
|
cached(registration) { // registration -> a ServiceWorkerRegistration instance
|
|
|
|
|
console.log('CACHED::: Content has been cached for offline use.')
|
|
|
|
|
},
|
|
|
|
|
updatefound(registration) { // registration -> a ServiceWorkerRegistration instance
|
|
|
|
|
console.log('UPDATEFOUND::: New content is downloading.')
|
|
|
|
|
},
|
|
|
|
|
updated(registration) { // registration -> a ServiceWorkerRegistration instance
|
|
|
|
|
console.log('New content is available; please refresh.')
|
|
|
|
|
},
|
|
|
|
|
offline() {
|
|
|
|
|
console.log('No internet connection found. App is running in offline mode.')
|
|
|
|
|
},
|
|
|
|
|
error(err) {
|
|
|
|
|
console.error('Error during service worker registration:', err)
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2018-12-10 11:38:22 +01:00
|
|
|
// ServiceWorkerRegistration: https://developer.mozilla.org/en-uk/docs/Web/API/ServiceWorkerRegistration
|
2018-10-12 16:42:54 +02:00
|
|
|
|
|
|
|
|
|
2019-01-31 13:52:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// "build": "quasar build -m pwa && workbox generateSW workbox-config.js",
|