Files
michaelschiemer/resources/js/serviceWorker.js
Michael Schiemer 55a330b223 Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
2025-08-11 20:13:26 +02:00

28 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Logger } from './core/logger.js';
export function registerServiceWorker() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
.then(reg => {
console.log('✅ Service Worker registriert:', reg.scope);
// Update found?
reg.onupdatefound = () => {
const installing = reg.installing;
installing.onstatechange = () => {
if (installing.state === 'installed') {
if (navigator.serviceWorker.controller) {
console.log('🔄 Neue Version verfügbar Seite neu laden?');
} else {
console.log('✅ Inhalte jetzt offline verfügbar');
}
}
};
};
})
.catch(err => {
Logger.error('Service Worker Fehler:', err);
});
}
}