From f9e94b384e0d65c52d2c3b5d6d6b73e9d218d2bc Mon Sep 17 00:00:00 2001 From: team-aathmavil Date: Sat, 7 May 2022 21:00:08 +0530 Subject: [PATCH] sw & 404 update --- 404.html | 2 +- index.html | 2 ++ sw.js | 15 +++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/404.html b/404.html index ead78c9..63f21ac 100644 --- a/404.html +++ b/404.html @@ -69,7 +69,7 @@
- +

Page Not Found

Sorry friend, it seems like you entered the wrong house!


diff --git a/index.html b/index.html index 3a0a7d4..a301a35 100644 --- a/index.html +++ b/index.html @@ -115,7 +115,9 @@

Generate a generic Privacy Policy for your website

Policy Effective Date

+

Owner Type

diff --git a/sw.js b/sw.js index 345a3d7..1bdf09b 100644 --- a/sw.js +++ b/sw.js @@ -1,7 +1,14 @@ importScripts( 'https://storage.googleapis.com/workbox-cdn/releases/6.4.1/workbox-sw.js' ); - workbox.routing.registerRoute( - ({request}) => request.destination === 'image', - new workbox.strategies.CacheFirst () - ) \ No newline at end of file + + // This will trigger the importScripts() for workbox.strategies and its dependencies: + workbox.loadModule('workbox-strategies'); + + self.addEventListener('fetch', event => { + if (event.request.url.endsWith('.svg', '.png')) { + // Referencing workbox.strategies will now work as expected. + const cacheFirst = new workbox.strategies.CacheFirst(); + event.respondWith(cacheFirst.handle({request: event.request})); + } + }); \ No newline at end of file