postMessage method
The postMessage()
method of the ServiceWorker interface sends a
message to the worker. The first parameter is the data to send to the
worker. The data may be any JavaScript object which can be handled by the
structured clone algorithm.
The service worker can send back information to its clients by using the
Client.postMessage method. The message will not be sent back to this
ServiceWorker
object but to the associated ServiceWorkerContainer
available via navigator.serviceWorker
.
Implementation
external void postMessage(
JSAny? message, [
JSObject optionsOrTransfer,
]);