Created
August 15, 2018 07:23
-
-
Save goofmint/746cd65a8b13f83419bec2cd43238236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('message', async (e) => { | |
const cache = await caches.open(CACHE_NAME) | |
switch (e.data.action) { | |
case 'cache': | |
const res = new Response(e.data.response); | |
cache.put(e.data.url, res); | |
break; | |
case 'delete': | |
cache.delete(e.data.url); | |
break; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment