mirror of https://github.com/dirtbags/moth.git
Hiding some debug messages
Only cache results for HTTP GETs
This commit is contained in:
parent
3fc84e532e
commit
18ee0ab3a2
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue