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 pack sprites | Precache | Needed for offline creature fallback |
| Icons | Precache | PWA requirement |
| Creature templates | CacheFirst | Rarely change |
| Generated assets | StaleWhileRevalidate | May update but stale is OK |
| API calls | NetworkFirst | Fresh data preferred |
Registration
Service worker is registered in src/main.tsx with an update prompt when a new version is available.
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
- IndexedDB ~50MB quota per origin
- No Push Notifications on iOS < 16.4
- No Badging API on iOS
- Service worker support varies by iOS version
standalonedisplay mode hides Safari chrome