7 new features inspired by iSolarCloud: 1. Animated Energy Flow Diagram — SVG/CSS animated power flow between PV, Load, Grid, HeatPump with real-time values 2. Weather Widget — temperature/condition on dashboard header 3. Curve Template Library — save/load Data Query presets 4. Enhanced Device Comparison — multi-device power overlay chart 5. Dispersion Rate Analysis — statistical variation across inverters with outlier detection (new Analysis tab) 6. PWA Support — manifest.json + service worker for mobile install 7. Alarm Subscription UI — configurable notification preferences Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
586 B
JavaScript
22 lines
586 B
JavaScript
// Simple service worker for PWA installability
|
|
const CACHE_NAME = 'zpark-ems-v1';
|
|
|
|
self.addEventListener('install', (event) => {
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener('activate', (event) => {
|
|
event.waitUntil(clients.claim());
|
|
});
|
|
|
|
self.addEventListener('fetch', (event) => {
|
|
// Network-first strategy for API calls, cache-first for static assets
|
|
if (event.request.url.includes('/api/')) {
|
|
event.respondWith(fetch(event.request));
|
|
} else {
|
|
event.respondWith(
|
|
caches.match(event.request).then(response => response || fetch(event.request))
|
|
);
|
|
}
|
|
});
|