Hiding some debug messages

Only cache results for HTTP GETs
This commit is contained in:
John Donaldson 2019-10-28 18:11:48 +00:00
parent 3fc84e532e
commit 18ee0ab3a2
1 changed files with 3 additions and 3 deletions

View File

@ -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;