Skip to content

Commit

Permalink
fix an issue with the service worker #104
Browse files Browse the repository at this point in the history
  • Loading branch information
tbela99 committed Sep 20, 2020
1 parent a484bf1 commit 871c11e
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion worker/dist/browser.administrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @license MIT License
*/
// @ts-check
// build fbc78ce 2020-05-16 17:28:47-04:00
// build a484bf1 2020-09-20 11:24:40-04:00
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{scope}worker{debug}.js", {
scope: "{scope}"
Expand Down
2 changes: 1 addition & 1 deletion worker/dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @license MIT License
*/
// @ts-check
// build fbc78ce 2020-05-16 17:28:47-04:00
// build a484bf1 2020-09-20 11:24:40-04:00
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{scope}worker{debug}.js", {
scope: "{scope}"
Expand Down
2 changes: 1 addition & 1 deletion worker/dist/browser.uninstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @license MIT License
*/
// @ts-check
// build fbc78ce 2020-05-16 17:28:47-04:00
// build a484bf1 2020-09-20 11:24:40-04:00
if ("serviceWorker" in navigator && navigator.serviceWorker.controller) {
navigator.serviceWorker.getRegistration().then((function(registration) {
registration.unregister().then((function(result) {
Expand Down
10 changes: 7 additions & 3 deletions worker/dist/serviceworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,14 +881,14 @@
* service worker build id
*/
buildid: {
value: "fbc78ce",
value: "a484bf1",
enumerable: true
},
/**
* service worker buid date
*/
builddate: {
value: "2020-05-16 17:28:47-04:00",
value: "2020-09-20 11:24:40-04:00",
enumerable: true
},
/**
Expand Down Expand Up @@ -1659,6 +1659,11 @@
self.addEventListener("fetch", (event) => {
event.respondWith((async function () {

if (!event.url || (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin')) {

return fetch(event.request);
}

let response;

const router = SW.routes.getRouter(event);
Expand Down Expand Up @@ -2105,7 +2110,6 @@
return caches.match(SW.app.offline.url);
}
}

});
}

Expand Down
2 changes: 1 addition & 1 deletion worker/dist/serviceworker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion worker/src/service/sw.service.fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
self.addEventListener("fetch", (event) => {
event.respondWith((async function () {

if (!event.url) {
if (!event.url || (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin')) {

return fetch(event.request);
}
Expand Down
2 changes: 1 addition & 1 deletion worker_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e7ad24017b85c6eae7d16c9cbf4a6f1f8f19eee3
cde1d7edd1e8fb2e1cf5f1855bebd34b58b142e0

0 comments on commit 871c11e

Please sign in to comment.