@serwist/window
Version:
Simplifies communications with Serwist packages running in the service worker
14 lines • 552 B
TypeScript
/**
* Sends a data object to a service worker via `postMessage` and resolves with
* a response (if any).
*
* A response can be sent by calling `event.ports[0].postMessage(...)`, which will
* resolve the promise returned by `messageSW()`. If no response is sent, the promise
* will never resolve.
*
* @param sw The service worker to send the message to.
* @param data An object to send to the service worker.
* @returns
*/
export declare const messageSW: (sw: ServiceWorker, data: any) => Promise<any>;
//# sourceMappingURL=messageSW.d.ts.map