Skip to content
Advertisement

Tag: service-worker

How to ensure that `self.skipWaiting()` works while allowing POST requests in service worker’s fetch event

I’ve noticed that my service worker doesn’t respond to self.skipWaiting() when there are still tasks to be run. In my service worker’s fetch event, I see various Firebase polls that use HTTP POST requests. If I handle these requests in the service worker like so: Then self.skipWaiting() always works as expected. However, if I do the following: Then self.skipWaiting() seems

Should I return a promise in a JS Service Worker onFetch callback function if I don’t want to do anything with the original request?

My scenario is the following: I have a Progressive Web App that uses a Service Worker where I need to catch the request and do something with it every time the user requests a resource or leaves the current URL I’m handling that through adding a callback to the fetch event of the worker I only care about requested resources

Advertisement