aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2018-01-21 18:13:27 +0530
committerGitHub <noreply@github.com>2018-01-21 18:13:27 +0530
commitaac477636e46ac9d9f30628f5995a70d7ab28c83 (patch)
tree6cc8a6fd1f51f4d3c5122e3087ce310a6a09ac4a
parent6aba7f9b4a6b8d88bce9b0186aede5dd4e31d4e8 (diff)
Create sw.js
-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',
+ ]);
+ })
+ );
+});