connect method

Port connect(
  1. int tabId,
  2. ConnectInfo? connectInfo
)

Connects to the content script(s) in the specified tab. The runtime.onConnect event is fired in each content script running in the specified tab for the current extension. For more details, see Content Script Messaging. returns A port that can be used to communicate with the content scripts running in the specified tab. The port's runtime.Port event is fired if the tab closes or does not exist.

Implementation

Port connect(
  int tabId,
  ConnectInfo? connectInfo,
) {
  return Port.fromJS($js.chrome.tabs.connect(
    tabId,
    connectInfo?.toJS,
  ));
}