Skip to content

Commit

Permalink
sw & 404 update
Browse files Browse the repository at this point in the history
  • Loading branch information
zcraber committed May 7, 2022
1 parent d0b6f83 commit f9e94b3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

<div id="page-404">
<div>
<img src="images/app_graphics/404.svg" style="width:50%;" class="center-block" />
<img src="/images/app_graphics/404.svg" style="width:50%;" class="center-block" />
<h1>Page Not Found</h1>
<p>Sorry friend, it seems like you entered the wrong house!</p>
<br/>
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ <h3>Generate a generic Privacy Policy for your website</h3>
<div class="control">
<p class="help form-label">Policy Effective Date</p>
<!-- Policy Effective Date-->
<label> Select the effective date for privacy policy
<input class="input is-primary" type="date" required="" v-model="effectiveFromDate">
</label>
</div>
<div class="control is-expanded">
<p class="help form-label">Owner Type</p>
Expand Down
15 changes: 11 additions & 4 deletions sw.js
Original file line number Diff line number Diff line change
@@ -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 ()
)

// 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}));
}
});

0 comments on commit f9e94b3

Please sign in to comment.