Files
hoppscotch/packages/hoppscotch-embed/src/modules/pwa.ts
2021-12-01 23:15:14 +05:30

12 lines
358 B
TypeScript

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