chore: update

This commit is contained in:
Anthony Fu 2021-04-04 02:21:30 +08:00
parent 793e8b9da1
commit 6e4e40d834
2 changed files with 12 additions and 10 deletions

12
src/modules/pwa.ts Normal file
View 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 })
})
}

View File

@ -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 })
})
}
}