Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.js

Created Aug 14, 2018
Embed
What would you like to do?
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