Skip to content

Instantly share code, notes, and snippets.

@mattzeunert
Created February 6, 2020 13:17
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 mattzeunert/11bb73ebf4f570f54717c4e6d4056d01 to your computer and use it in GitHub Desktop.
Save mattzeunert/11bb73ebf4f570f54717c4e6d4056d01 to your computer and use it in GitHub Desktop.
self.addEventListener("install", async e => {
caches.open("v1").then(function (cache) {
return cache.addAll(["/app", "/app.css"]);
});
});
self.addEventListener("fetch", event => {
event.respondWith(
caches.match(event.request).then(cachedResponse => {
return cachedResponse || fetch(event.request);
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment