aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/sw.js b/sw.js
new file mode 100644
index 0000000..8a4bd47
--- /dev/null
+++ b/sw.js
@@ -0,0 +1,18 @@
+// sw.js
+self.addEventListener('install', e => {
+ e.waitUntil(
+ // after the service worker is installed,
+ // open a new cache
+ caches.open('my-pwa-cache').then(cache => {
+ // add all URLs of resources we want to cache
+ return cache.addAll([
+ '/',
+ '/index.html',
+ '/about.html',
+ '/images/doggo.jpg',
+ '/styles/main.min.css',
+ '/scripts/main.min.js',
+ ]);
+ })
+ );
+});