mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
11 lines
287 B
TypeScript
11 lines
287 B
TypeScript
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;
|
|
}
|