Create service worker in app
This commit is contained in:
parent
f907d68629
commit
003c31c0a1
3 changed files with 6 additions and 0 deletions
|
@ -14,6 +14,7 @@ import DesktopNav from './components/desktop_nav/desktop_nav.vue'
|
|||
import UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue'
|
||||
import PostStatusModal from './components/post_status_modal/post_status_modal.vue'
|
||||
import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue'
|
||||
import { getOrCreateServiceWorker } from './services/push/push'
|
||||
import { windowWidth, windowHeight } from './services/window_utils/window_utils'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
|
@ -45,6 +46,7 @@ export default {
|
|||
const val = this.$store.getters.mergedConfig.interfaceLanguage
|
||||
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
||||
window.addEventListener('resize', this.updateMobileState)
|
||||
getOrCreateServiceWorker()
|
||||
},
|
||||
destroyed () {
|
||||
window.removeEventListener('resize', this.updateMobileState)
|
||||
|
|
|
@ -109,3 +109,5 @@ export function unregisterPushNotifications (token) {
|
|||
]).catch((e) => console.warn(`Failed to disable Web Push Notifications: ${e.message}`))
|
||||
}
|
||||
}
|
||||
|
||||
export { getOrCreateServiceWorker }
|
||||
|
|
|
@ -67,3 +67,5 @@ self.addEventListener('notificationclick', (event) => {
|
|||
if (clients.openWindow) return clients.openWindow('/')
|
||||
}))
|
||||
})
|
||||
|
||||
self.addEventListener('fetch', _ => _)
|
||||
|
|
Loading…
Reference in a new issue