summaryrefslogtreecommitdiff
path: root/static/js/worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/worker.js')
-rw-r--r--static/js/worker.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/static/js/worker.js b/static/js/worker.js
new file mode 100644
index 0000000..84d94df
--- /dev/null
+++ b/static/js/worker.js
@@ -0,0 +1,22 @@
+const CACHE_NAME = 'cafe';
+const urlsToCache = [
+ '/',
+ '/static/css/style.css',
+ '/static/js/htmx.min.js',
+ '/static/js/app.js',
+ '/static/manifest.json'
+];
+
+self.addEventListener('install', (event) => {
+ event.waitUntil(
+ caches.open(CACHE_NAME)
+ .then((cache) => cache.addAll(urlsToCache))
+ );
+});
+
+self.addEventListener('fetch', (event) => {
+ event.respondWith(
+ caches.match(event.request)
+ .then((response) => response || fetch(event.request))
+ );
+}); \ No newline at end of file