onMessage property

EventStream<OnMessageEvent> get onMessage

Fired when a message is sent from either an extension process (by runtime.sendMessage) or a content script (by tabs.sendMessage).

Implementation

EventStream<OnMessageEvent> get onMessage =>
    $js.chrome.runtime.onMessage.asStream(($c) => (
          JSAny? message,
          $js.MessageSender sender,
          JSFunction sendResponse,
        ) {
          return $c(OnMessageEvent(
            message: message?.dartify(),
            sender: MessageSender.fromJS(sender),
            sendResponse: sendResponse,
          ));
        }.toJS);