This commit is contained in:
@@ -65,7 +65,17 @@ app.use(PrimeVue, {
|
||||
app.mount('#app')
|
||||
|
||||
registerServiceWorker()
|
||||
.then(() => console.log('Service Worker успешно зарегистрирован'))
|
||||
.then((registration) => {
|
||||
console.log('Service Worker успешно зарегистрирован')
|
||||
navigator.serviceWorker.addEventListener('message', (event) => {
|
||||
console.debug('serviceWorker message', event.data)
|
||||
if (event.data.type === 'notificationClick' && !event.data.matchUrl) {
|
||||
const url = new URL(event.data.url, location.origin)
|
||||
console.debug('go to', `${url.pathname}${url.search}${url.hash}`)
|
||||
router.push(`${url.pathname}${url.search}${url.hash}`)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(console.error)
|
||||
|
||||
window.PouchDB = PouchDB // it for debug in console only
|
||||
|
||||
Reference in New Issue
Block a user