* Send data to the Service Worker controlling this client. * This triggers the `message` event listener on ServiceWorkerGlobalScope.
(type: OutgoingWorkerEvents)
| 160 | * This triggers the `message` event listener on ServiceWorkerGlobalScope. |
| 161 | */ |
| 162 | public postMessage(type: OutgoingWorkerEvents): void { |
| 163 | invariant( |
| 164 | SUPPORTS_SERVICE_WORKER, |
| 165 | 'Failed to post message on a WorkerChannel: the Service Worker API is unavailable in this environment. This is likely an issue with MSW. Please report it on GitHub: https://github.com/mswjs/msw/issues', |
| 166 | ) |
| 167 | |
| 168 | this.#getWorker().then((worker) => { |
| 169 | worker.postMessage(type) |
| 170 | }) |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Terminal teardown. Removes the `navigator.serviceWorker` message listener |
nothing calls this directly
no test coverage detected