Skip to content

Instantly share code, notes, and snippets.

@jonchenn
Last active February 1, 2019 18:31
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 jonchenn/e412adeee5ce20df9a6d85c51c549b8c to your computer and use it in GitHub Desktop.
Save jonchenn/e412adeee5ce20df9a6d85c51c549b8c to your computer and use it in GitHub Desktop.
self.addEventListener('fetch', async (event) => {
if (event.request.method === 'POST') {
// Respond with cached data and update from network in the background.
event.respondWith(staleWhileRevalidate(event));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment