feat: remove Cache API, rework preload(), cancel() and fetch() (#25289)

* feat: remove Cache API, rework preload(), cancel() and fetch()

perf - replace broadcast channel with direct postMessage

* remove sw response handling

* review comments
This commit is contained in:
Min Idzelis
2026-02-12 11:25:20 -05:00
committed by GitHub
parent a62e8ed179
commit 81f592ca52
7 changed files with 119 additions and 144 deletions

View File

@@ -0,0 +1,17 @@
export class ServiceWorkerMessenger {
readonly #serviceWorker: ServiceWorkerContainer;
constructor(serviceWorker: ServiceWorkerContainer) {
this.#serviceWorker = serviceWorker;
}
/**
* Send a one-way message to the service worker.
*/
send(type: string, data: Record<string, unknown>) {
this.#serviceWorker.controller?.postMessage({
type,
...data,
});
}
}