Last active
May 3, 2022 21:53
-
-
Save tkdaj/9aa196792ba8aac3279ef9e9af3f54ba 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('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); | |
})()); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment