✨ (pwa) vite pwa configuration
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,4 +1,3 @@
|
||||
import '@/registerServiceWorker'
|
||||
import 'notyf/notyf.min.css'
|
||||
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import { serviceWorkerBusEvent } from '@/bus/serviceWorkerEventBus'
|
||||
import { register } from 'register-service-worker'
|
||||
|
||||
if (import.meta.env.NODE_ENV === 'production') {
|
||||
register(`${import.meta.env.BASE_URL}service-worker.js`, {
|
||||
ready() {
|
||||
console.log(
|
||||
'App is being served from cache by a service worker.\n' +
|
||||
'For more details, visit https://goo.gl/AFskqB'
|
||||
)
|
||||
},
|
||||
registered() {
|
||||
console.log('Service worker has been registered.')
|
||||
},
|
||||
cached() {
|
||||
console.log('Content has been cached for offline use.')
|
||||
},
|
||||
updatefound() {
|
||||
console.log('New content is downloading.')
|
||||
},
|
||||
updated() {
|
||||
console.log('New content is available; please refresh.')
|
||||
serviceWorkerBusEvent.emit()
|
||||
},
|
||||
offline() {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
)
|
||||
},
|
||||
error(error) {
|
||||
console.error('Error during service worker registration:', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user