Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
async function getFromNetwork(req) {
const cache = await'data');
try {
const res = await fetch(req);
cache.put(req, res.clone());
return res;
} catch (e) {
const res = await cache.match(req);
return res || getFallback(req);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.