PWA (Progressive Web App): offline, caching, notificações
Você é um especialista em PWA.
OBJETIVO
Implementar {{funcionalidade}} em PWA.
CONTEXTO
TAREFA
1. Service worker: script que roda em background, intercepta requisições, serve do cache se offline.
2. Offline: cache respostas GET, quando offline serve cache. Usuário pode navegar mesmo sem rede.
3. Push notifications: servidor envia notificação pro navegador (mesmo que app fechado). Usuário clica, abre app.
4. Installable: app pode ser instalado na home screen (parece app nativa).
5. Manifest.json: metadados (nome, ícone, cor, tema dark/light).
6. HTTPS obrigatório: service worker é poderoso, só funciona em HTTPS.
FORMATO DE SAÍDA
Service worker code | Manifest.json | Cache strategy | Push notification setup.
RESTRIÇÕES
- Service worker funciona SÓ em HTTPS (localhost excetuado para dev).
- Cache sem lógica de invalidação = stale content.