Skip to content

Commit

Permalink
fix fetch issue when devtoools is open #104
Browse files Browse the repository at this point in the history
  • Loading branch information
tbela99 committed Oct 15, 2020
1 parent 6795f42 commit 52a3f58
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion worker/dist/browser.administrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// @ts-check

// build 8fb8103 2020-10-14 23:07:21-04:00
// build 6795f42 2020-10-15 07:47:03-04:00

if ("serviceWorker" in navigator) {
navigator.serviceWorker.
Expand Down
2 changes: 1 addition & 1 deletion worker/dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// @ts-check

// build 8fb8103 2020-10-14 23:07:21-04:00
// build 6795f42 2020-10-15 07:47:03-04:00

if ("serviceWorker" in navigator) {
navigator.serviceWorker.
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 @@
*/
// @ts-check

// build 8fb8103 2020-10-14 23:07:21-04:00
// build 6795f42 2020-10-15 07:47:03-04:00

if ("serviceWorker" in navigator && navigator.serviceWorker.controller) {
navigator.serviceWorker.getRegistration().then(function (registration) {
Expand Down
13 changes: 4 additions & 9 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: "8fb8103",
value: "6795f42",
enumerable: true
},
/**
* service worker buid date
*/
builddate: {
value: "2020-10-14 23:07:21-04:00",
value: "2020-10-15 07:47:03-04:00",
enumerable: true
},
/**
Expand Down Expand Up @@ -1658,12 +1658,7 @@

self.addEventListener("fetch", (event) => {

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

return;
}

event.respondWith((async function () {
event.respondWith(!event.url || (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') ? fetch(event.request) : (async function () {

let response;

Expand Down Expand Up @@ -1691,7 +1686,7 @@
// offline page should be returned from the previous loop
} catch (error) {

console.error("😭", error);
console.error("😭", error, error.stack);
}
}

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

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions worker/src/service/sw.service.fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ import {

self.addEventListener("fetch", (event) => {

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

return;
}

event.respondWith((async function () {
event.respondWith(!event.url || (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') ? fetch(event.request) : (async function () {

let response;

Expand Down Expand Up @@ -55,7 +50,7 @@ self.addEventListener("fetch", (event) => {
// offline page should be returned from the previous loop
} catch (error) {

console.error("😭", error);
console.error("😭", error, error.stack);
}
}

Expand Down
2 changes: 1 addition & 1 deletion worker_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d0754001c212d11077e8882cf7bf662d25057caa
e2c5d4d7cf4b102866c7c5c147985af811ff31f7

0 comments on commit 52a3f58

Please sign in to comment.