oxigdal-pwa
Progressive Web App capabilities for OxiGDAL - Build offline-capable geospatial applications.
Features
- Service Worker Integration: Full service worker lifecycle management
- Offline Caching: Multiple caching strategies (cache-first, network-first, stale-while-revalidate)
- Background Sync: Queue operations for background synchronization
- Push Notifications: Complete push notification support
- Web App Manifest: Automated manifest generation
- PWA Lifecycle: Install prompts and update management
- Geospatial Optimizations: Tile caching and geospatial data handling
Usage
Basic PWA Setup
use ;
let config = new
.with_service_worker_url
.with_cache_management
.with_geospatial_cache;
let mut app = new;
app.initialize.await?;
Service Worker Registration
use ServiceWorkerRegistry;
let registry = with_script_url
.with_scope;
let registration = registry.register.await?;
Caching Strategies
use CacheStrategy;
// Cache-first for static assets
let static_cache = cache_first;
// Network-first for API calls
let api_cache = network_first;
// Stale-while-revalidate for dynamic content
let dynamic_cache = stale_while_revalidate;
Geospatial Tile Caching
use ;
let cache = with_defaults;
// Prefetch tiles for a region
let bbox = new?;
let tiles = cache.prefetch_tiles.await?;
Push Notifications
use ;
let manager = new;
let permission = request_permission.await?;
if permission.is_granted
Web App Manifest
use ;
let manifest = geospatial
.description
.colors
.add_standard_icons
.build;
let json = manifest.to_json?;
Background Sync
use ;
let sync = new;
let options = new;
sync.register.await?;
Service Worker Template
A complete service worker template is provided in templates/service-worker.js. It includes:
- Install and activate lifecycle events
- Multiple caching strategies
- Background sync handling
- Push notification support
- Message handling for cache management
Examples
See examples/basic_pwa.rs for a complete PWA application example.
COOLJAPAN Policies
- ✅ Pure Rust implementation
- ✅ WASM-compatible
- ✅ No
unwrap()usage - ✅ Comprehensive error handling
License
Apache-2.0