Created
May 10, 2017 17:09
-
-
Save ukmadlz/2c4f67d0d6499b9da265439e2665936c to your computer and use it in GitHub Desktop.
Cloudinary PWA React Blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener("fetch", function (event) { | |
event.respondWith( | |
caches.open(cacheNameStatic).then(function(cache) { | |
return cache.match(event.request).then(function(response) { | |
var fetchPromise = fetch(event.request).then(function(networkResponse) { | |
cache.put(event.request, networkResponse.clone()); | |
return networkResponse; | |
}) | |
return response || fetchPromise; | |
}) | |
}) | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment