developit / unfetch

🐕 Bare minimum 500b fetch polyfill.
https://npm.im/unfetch
MIT License
5.71k stars 201 forks source link

Use unfetch with service worker? #115

Closed bschwartz757 closed 4 years ago

bschwartz757 commented 5 years ago

Hello, just wondering if anyone has tried using unfetch with service workers. I'm wondering if requests made using unfetch are picked up by the service worker's fetch event listeners, or if there are things to be aware of there.

simonbuerger commented 5 years ago

Browsers that support service workers all support the fetch API natively, so if you're using unfetch as a polyfill it won't be an issue (as that will just use native fetch). Even if you're using it as a ponyfill I'm pretty sure service workers still intercept standard XHRs, but I've never tried it.

developit commented 4 years ago

Great answer @simonbuerger, couldn't have said it better myself.