Skip to content

Commit

Permalink
Merge branch 'hotfix/service-worker-browser-extension-fetch' into pro…
Browse files Browse the repository at this point in the history
…duction
  • Loading branch information
aronnebrivio committed May 11, 2021
2 parents a247294 + 91dd113 commit 92e194b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aronnebrivio.github.io",
"version": "1.2.1",
"version": "1.2.2",
"description": "Personal frontpage",
"main": "src/index.html",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions src/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ self.addEventListener('activate', evt => {

// fetch event
self.addEventListener('fetch', evt => {
if (!(evt.request.url.indexOf('http') === 0)) return; // skip the request. if request is not made with http protocol

evt.respondWith(
caches.match(evt.request).then(cacheRes => {
return cacheRes || fetch(evt.request).then(fetchRes => {
Expand Down

0 comments on commit 92e194b

Please sign in to comment.