feat: add App Services framework for background event handling
Add iOS-style background service system that allows apps to register
JavaScript handlers that run globally (even when app is not active).
Services can listen to WebSocket events, update badges dynamically,
show notifications, and run custom logic.
Framework Features:
- AppServices.register() - Register app background services
- AppServices.updateBadge() - Update facet/app badges in real-time
- AppServices.updateSubmenu() - Dynamically update submenu items
- AppServices.notify() - Show browser or in-app toast notifications
- Auto-loading services from app templates with isolated scopes
- XSS protection for notification content
Implementation:
- BaseApp.get_service_template() - Apps return service.html path
- Service templates use Jinja2 (can use url_for() for API calls)
- Services auto-loaded in app.html with IIFE wrapping
- Example service in apps/home demonstrates patterns
Use Cases:
- Real-time badge updates on WebSocket events
- Notifications for important events when not viewing app
- Dynamic UI updates without page refresh
- Background data synchronization
Documentation updated in convey/DESIGN.md with API reference and
usage patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>