onMessage property
Stream<ExtendableMessageEvent>
onMessage
An event handler fired whenever a message event occurs — when incoming
messages are received. Controlled pages can use the
MessagePort.postMessage() method to send messages to service workers.
The service worker can optionally send a response back via the
MessagePort exposed in event.data.port, corresponding to the controlled
page.
onmessage
is actually fired with ExtendableMessageEvent
, but
since we are merging the interface into Window
, we should
make sure it's compatible with window.onmessage
onmessage: (messageevent: ExtendableMessageEvent) => void;
Implementation
Stream<ExtendableMessageEvent> get onMessage => _onMessage ??=
callbackToStream(_delegate, 'onmessage', ExtendableMessageEvent._);