Skip to content

Instantly share code, notes, and snippets.

@zprima
Created January 27, 2019 12:33
Show Gist options
  • Save zprima/f76c64344f8997bed98dbed9bea652ac to your computer and use it in GitHub Desktop.
Save zprima/f76c64344f8997bed98dbed9bea652ac to your computer and use it in GitHub Desktop.
medium_p2_c5
self.addEventListener('fetch', function (event) {
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request);
})
);
});
self.addEventListener('install', function (e) {
e.waitUntil(
caches.open('the-magic-cache').then(function (cache) {
return cache.addAll([
'/',
'/index.html',
'/app.js',
'/sw.js',
'/styles.css'
]);
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment