feat: add Progressive Web App support with service worker and offline functionality

This commit is contained in:
2025-11-24 15:04:47 +02:00
parent a3d4fed842
commit fb70db5595
9 changed files with 185 additions and 4 deletions

View File

@@ -1,5 +1,23 @@
// Application initialization and event handlers
// Register service worker for PWA functionality
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js')
.then(registration => {
console.log('Service Worker registered:', registration.scope);
// Check for updates periodically
setInterval(() => {
registration.update();
}, 60000); // Check every minute
})
.catch(error => {
console.warn('Service Worker registration failed:', error);
});
});
}
document.addEventListener('DOMContentLoaded', function () {
// Initialize user settings
initSettings();