mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Implement PWA splash screens and fix service worker registration (#124)
- Add iOS splash screen images and media query entries for all device sizes - Fix splash screen media query for iPhone SE/8 (375x667 at 2x) - Simplify registerServiceWorker to fire-and-forget void function - Add workbox-core and workbox-window as dev dependencies for SW build
This commit is contained in:
1 parent
87dc4edef8
commit
e3051b8aef
19 files changed
+29
-15
No files matched your search
@@ -1,18 +1,10 @@
|
||||
export async function registerServiceWorker(): Promise<ServiceWorkerRegistration | null> {
|
||||
if (!("serviceWorker" in navigator)) return null;
|
||||
export function registerServiceWorker(): void {
|
||||
if (!("serviceWorker" in navigator)) return;
|
||||
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.register("/sw.js", {
|
||||
scope: "/",
|
||||
type: "module",
|
||||
});
|
||||
|
||||
registration.update().catch(() => {});
|
||||
|
||||
return registration;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
navigator.serviceWorker
|
||||
.register("/sw.js", { scope: "/", type: "module" })
|
||||
.then((registration) => registration.update())
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
export async function getServiceWorkerRegistration(): Promise<ServiceWorkerRegistration | null> {
|
||||
|
||||
Reference in new issue
Block a user