Skip to content

Instantly share code, notes, and snippets.

@FlorianRappl
Created July 2, 2018 21:01
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 FlorianRappl/f41c0a4e2ebdc2deeb7a2c9036763140 to your computer and use it in GitHub Desktop.
Save FlorianRappl/f41c0a4e2ebdc2deeb7a2c9036763140 to your computer and use it in GitHub Desktop.
self.addEventListener('fetch', async e => {
const req = e.request;
const res = isApiCall(req) ? getFromNetwork(req) : getFromCache(req);
await e.respondWith(res);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment