mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Registe service worker
This commit is contained in:
10
server/sw.ts
Normal file
10
server/sw.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export async function registeServiceWorker(
|
||||
path: string,
|
||||
options?: RegistrationOptions,
|
||||
) {
|
||||
const r = await navigator.serviceWorker.getRegistration(path);
|
||||
if (r === undefined) {
|
||||
return await navigator.serviceWorker.register(path, options);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
Reference in New Issue
Block a user