sendMessage method
Sends a single message to the content script(s) in the specified tab. The
runtime.onMessage event is fired in each content script running in the
specified tab for the current extension.
message The message to send. This message should be a JSON-ifiable
object.
returns Promise that resolves with the response from the content
script. If an error occurs while connecting to the specified tab, the
promise will be rejected.
Implementation
Future<Object?> sendMessage(
int tabId,
Object message,
SendMessageOptions? options,
) async {
var $res = await $js.chrome.tabs
.sendMessage(
tabId,
message.jsify()!,
options?.toJS,
)
.toDart;
return $res?.dartify();
}