Skip to content

Instantly share code, notes, and snippets.

@kypflug

kypflug/sw-7.js Secret

Created December 15, 2017 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kypflug/547194a4e5f80eb34720541e77b31d6f to your computer and use it in GitHub Desktop.
Save kypflug/547194a4e5f80eb34720541e77b31d6f to your computer and use it in GitHub Desktop.
self.onfetch = function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request).catch(function() {
return caches.match('/fallback.htm1');
});
})
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment