Skip to content

Instantly share code, notes, and snippets.

self.addEventListener('fetch', e => {
if(someValue) {
e.respondWith((async () => {
const res = await fetch('my/api');
asyncDecision = await res.text();
return asyncDecision === 'true' ? await fetch('path1') : await fetch(e.request);
})());
}
})