Yes, the service worker catches all the events you have selected. Register a service worker using:
navigator.serviceWorker.register('/service-worker.js');
In the working script service, set the handler for the fetch event:
// `self` is a ServiceWorkerGlobalScope self.addEventListener('fetch', function(event) { console.log("fetch event:", event.request.url); });
Here's a plunker that demonstrates this. You will need to run the demo twice from the Live Preview (once to register a service worker and see the selection events in the console again). Do not forget to unregister a service worker from DevTools as a cleanup: DevTools> Resources / Applications> Service Workers (left panel)> Delete (right) .
source share