postMessage method

void postMessage(
  1. JSAny? message, [
  2. JSObject optionsOrTransfer
])

@AvailableInWorkers("service")

The postMessage() method of the Client interface allows a service worker to send a message to a client (a Window, Worker, or SharedWorker). The message is received in the "message" event on ServiceWorkerContainer.

Implementation

external void postMessage(
  JSAny? message, [
  JSObject optionsOrTransfer,
]);