feat: init hoppscotch-embed package
This commit is contained in:
12
packages/hoppscotch-embed/src/modules/pwa.ts
Normal file
12
packages/hoppscotch-embed/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 })
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user