Progressive Web App
WEFA is installable as a PWA with offline support.
Manifest
{
"name": "WEFA",
"short_name": "WEFA",
"display": "standalone",
"start_url": "/",
"scope": "/",
"theme_color": "#...",
"background_color": "#...",
"icons": [
{ "src": "/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" }
]
}
Service Worker
Configured via vite-plugin-pwa with Workbox in vite.config.ts.
Caching Strategy
| Resource | Strategy | Rationale |
|---|---|---|
| App shell | Precache | Always available offline |
| Seed creature thumbnails | Precache | Offline deck/detail fallback without 3D install cost |
| Icons | Precache | PWA requirement |
| Creature thumbnails requested at runtime | CacheFirst | Cheap and stable |
| Creature GLBs | CacheFirst | On-demand 3D with bounded runtime storage |
Registration
Service worker is registered in src/main.tsx with registerSW({ immediate: true }).
The production build also runs scripts/check-sw-precache.cjs, which fails if .glb files, raw PBR sidecars, or creatures/manifest.json leak into the precache manifest.
Web APIs Used
| API | Purpose |
|---|---|
| Background Sync | Flush job queue when reconnected |
| Push / Notifications | Care reminders (configurable, default daily) |
| Badging API | Pending creature/badge notification count |
| Screen Wake Lock | Keep screen on during active game |
| Screen Orientation | Lock portrait during gameplay |
| Vibration | Haptic feedback on key interactions |
| Web Audio | Sound effects (optional) |
iOS Considerations
- Browser storage quotas vary and may be evicted under pressure
- Default install keeps creature 3D out of the precache to protect mobile storage
- Optional offline 3D pins are stored in Cache Storage with Dexie metadata
- No Push Notifications on iOS < 16.4
- No Badging API on iOS
- Service worker support varies by iOS version
standalonedisplay mode hides Safari chrome