Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created August 14, 2018 14:20
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 goofmint/c4069d4b4934f7ad4625afb58db78494 to your computer and use it in GitHub Desktop.
Save goofmint/c4069d4b4934f7ad4625afb58db78494 to your computer and use it in GitHub Desktop.
self.addEventListener('message', e => {
if (e.data.action == 'cache') {
caches.open(CACHE_NAME)
.then((cache) => {
const res = new Response(e.data.response);
cache.put(e.data.url, res);
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment