chore: update
This commit is contained in:
parent
793e8b9da1
commit
6e4e40d834
12
src/modules/pwa.ts
Normal file
12
src/modules/pwa.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { UserModule } from '~/types'
|
||||||
|
|
||||||
|
// https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
|
||||||
|
export const install: UserModule = ({ isClient, router }) => {
|
||||||
|
if (!isClient)
|
||||||
|
return
|
||||||
|
|
||||||
|
router.isReady().then(async() => {
|
||||||
|
const { registerSW } = await import('virtual:pwa-register')
|
||||||
|
registerSW({ immediate: true })
|
||||||
|
})
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
import { UserModule } from '~/types'
|
|
||||||
|
|
||||||
export const install: UserModule = ({ isClient, router }) => {
|
|
||||||
if (isClient) {
|
|
||||||
router.isReady().then(async() => {
|
|
||||||
const { registerSW } = await import('virtual:pwa-register')
|
|
||||||
registerSW({ immediate: true })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user