mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 17:32:41 +00:00
feat: tauri serial polyfill
This commit is contained in:
16
src/routes/pwa-setup.ts
Normal file
16
src/routes/pwa-setup.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type {RegisterSWOptions} from "vite-plugin-pwa/types"
|
||||
|
||||
export async function initPwa(): Promise<string> {
|
||||
// @ts-expect-error confused TS
|
||||
const {pwaInfo} = await import("virtual:pwa-info")
|
||||
// @ts-expect-error confused TS
|
||||
const {registerSW} = await import("virtual:pwa-register")
|
||||
registerSW({
|
||||
immediate: true,
|
||||
onRegisterError(error) {
|
||||
console.log("ServiceWorker Registration Error", error)
|
||||
},
|
||||
} satisfies RegisterSWOptions)
|
||||
|
||||
return pwaInfo ? pwaInfo.webManifest.linkTag : ""
|
||||
}
|
||||
Reference in New Issue
Block a user