diff options
| author | chers <admin@tilde.tailb619f6.ts.net> | 2026-07-31 09:18:39 +0000 |
|---|---|---|
| committer | chers <admin@tilde.tailb619f6.ts.net> | 2026-07-31 09:18:39 +0000 |
| commit | 7023e4c7c8f158df78b5e71ddc2640290409eca1 (patch) | |
| tree | 077fb46bdb484bbbf7f9a81fd1d512f66650be10 /static/sw.js | |
Diffstat (limited to 'static/sw.js')
| -rw-r--r-- | static/sw.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 0000000..edf8149 --- /dev/null +++ b/static/sw.js @@ -0,0 +1,31 @@ +const CACHE_NAME = 'cl-bbs-v2'; +const ASSETS = [ + '/static/styles/themes/default.css', + '/static/styles/themes/dark.css', + '/static/styles/themes/no.css', + '/static/styles/themes/colored.css', + '/static/styles/themes/matrix.css', + '/static/favicon.ico', + '/static/schemebbs.png' +]; + +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => { + return cache.addAll(ASSETS); + }) + ); +}); + +self.addEventListener('fetch', (event) => { + event.respondWith( + caches.match(event.request).then((cachedResponse) => { + if (cachedResponse) { + return cachedResponse; + } + return fetch(event.request).catch(() => { + // Fallback or offline page + }); + }) + ); +}); |
