Message from JavaScript discussions

July 2019

— Hey my serviceworker is now proxy fetching well, but keeps telling me fetch-worker.js:10 Uncaught (in promise) TypeError: Failed to execute 'clone' on 'Response': Response body is already used ... it stinks!

Message permanent page


`this.addEventListener('fetch', function (event) {
console.log('fetching ->', event.request);
.then(function (resp) {
return resp || fetch(event.request)
.then(function (response) {'v1')
.then(function (cache) {
cache.put(event.request, response.clone());
return response;

— I think i havent understand the arrow functions quite yet in js. Whats wrong here ?

const getComputerWeapon = Math.floor(Math.random() *3) => {

Message permanent page

— Wat

— The start of an arrow function should be an argument list

— Not an expression

— Oh

— And if i have no arguments then i just put a () into it ?

— Yep

— Ahhhhh :D Thanks now i got it

— So as far as im concerned, a webworker wont really outsource the fetch in another thread but is prett y much just a proxy, and therefore better for computing stuff? still useful to me, but still not sure if im getting this right. any thoughts on this?

Message permanent page

— Btw im not trying to build a pwa