From 18ee0ab3a2b3fed865435f78429612870128d5a6 Mon Sep 17 00:00:00 2001 From: John Donaldson Date: Mon, 28 Oct 2019 18:11:48 +0000 Subject: [PATCH] Hiding some debug messages Only cache results for HTTP GETs --- theme/sw.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/theme/sw.js b/theme/sw.js index fcaf9c3..aee1efa 100644 --- a/theme/sw.js +++ b/theme/sw.js @@ -28,16 +28,16 @@ self.addEventListener('fetch', function(event) { event.respondWith( fetch(event.request) .catch(function(evt) { - console.log("Falling back to cache for " + event.request.url); + //console.log("Falling back to cache for " + event.request.url); cache_used = true; return caches.match(event.request, {ignoreSearch: true}); }).then(function(res) { if (res && res.ok) { let res_clone = res.clone(); - if (! cache_used ) { + if (! cache_used && event.request.method == "GET" ) { caches.open(cacheName).then(function(cache) { cache.put(event.request, res_clone); - console.log("Storing " + event.request.url + " in cache"); + //console.log("Storing " + event.request.url + " in cache"); }); } return res;