Pre-cache capture and queue pages for offline support

After the SW activates, fetch /capture and /queue in the background
so they are in the runtime cache and available offline immediately
without requiring manual navigation first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 22:23:32 -06:00
parent 37f417eb5b
commit e88308a622

View File

@@ -89,6 +89,13 @@
.catch((error) => {
console.error('Service Worker registration failed:', error);
});
// Pre-cache key pages for offline support once SW is active
navigator.serviceWorker.ready.then(() => {
['/capture', '/queue'].forEach(url => {
fetch(url).catch(() => {});
});
});
});
} else {
console.warn('Service Workers not supported in this browser');