aboutsummaryrefslogtreecommitdiff
path: root/sw.js
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2018-01-20 22:27:21 +0530
committerGitHub <noreply@github.com>2018-01-20 22:27:21 +0530
commit20e5d052155112578d298f64ca49c5c31d13b6aa (patch)
treef454f9282b931a5ff20ddfb9ee35a7e590cf48de /sw.js
parent91bb4b075bb4f5c6211def101c73479db0acbb01 (diff)
Update sw.js
Diffstat (limited to 'sw.js')
-rw-r--r--sw.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/sw.js b/sw.js
index 8976e07..8865b80 100644
--- a/sw.js
+++ b/sw.js
@@ -12,8 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-/** An empty service worker! */
+
+self.addEventListener('install', function(e) {
+ e.waitUntil(
+ caches.open('your-magic-cache').then(function(cache) {
+ return cache.addAll([
+ '/',
+ '/index.html',
+ '/Contact.html',
+ '/404.html',
+ '/css/*',
+ '/js/*',
+ '/mjolnir/*',
+ ]);
+ })
+ );
+});
self.addEventListener('fetch', function(event) {
- /** An empty fetch handler! */
+ event.respondWith(
+ caches.match(event.request).then(function(response) {
+ return response || fetch(event.request);
+ })
+ );
});