I was having service worker implemented in angular.js application where we have some custom code written in self.addEventListener('fetch', function (event) . Now i am planning to migrate the application to angular, and i found in angular we have the special plugin which will do all configuration and cache cleanup. "@angular/service-worker": "~10.0.6",.
Now i am suffering to have the custom code implemented inside fetch event to integrate in angular version. Is there any way we can have the fetch method override in to a component and do the operation from there.
Based on your message this steps were done using [email protected].
Edit service worker file.
<project_name>/node_modules/@angular/service-worker/ngsw-worker.jshandleFetch functionLine 1121.handleFetchWithFreshnessandhandleFetchWithPerformanceas examples.Patch file
npx patch-package @angular/service-workerpostinstall scripttopackage.jsonpatch-packagepackagenpm install --save-dev patch-packageTest service worker