messageSW.d.ts 679 B

1234567891011121314151617
  1. import './_version.js';
  2. /**
  3. * Sends a data object to a service worker via `postMessage` and resolves with
  4. * a response (if any).
  5. *
  6. * A response can be set in a message handler in the service worker by
  7. * calling `event.ports[0].postMessage(...)`, which will resolve the promise
  8. * returned by `messageSW()`. If no response is set, the promise will not
  9. * resolve.
  10. *
  11. * @param {ServiceWorker} sw The service worker to send the message to.
  12. * @param {Object} data An object to send to the service worker.
  13. * @return {Promise<Object|undefined>}
  14. * @memberof module:workbox-window
  15. */
  16. declare function messageSW(sw: ServiceWorker, data: {}): Promise<any>;
  17. export { messageSW };