Sharing fetch handler logic defined across multiple service workers

Viewed 2584

Following This Discussion, Where there is a comment that speaks of

patching a Fetch

by overriding self.fetch, self.XMLHttpRequest, and self.caches (for cache.add/addAll)? It would seem these would let you intercept network requests and manipulate responses before the main SW script sees them.

I have been looking out for any documentation that speaks of such stuff, and can not seem to find any.

In a scenario where I simply need multiple service workers to co exist in a single scope,

After having an importScripts in one of them to import the event handlers of the other,

How exactly would I patch a fetch / avoid a fetch race / have both the fetch handlers work?

1 Answers
Related