executeScript method

  1. @Deprecated(r'Replaced by $(ref:scripting.executeScript) in Manifest V3.')
Future<List<Object>?> executeScript(
  1. int? tabId,
  2. InjectDetails details
)

Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. tabId The ID of the tab in which to run the script; defaults to the active tab of the current window. details Details of the script to run. Either the code or the file property must be set, but both may not be set at the same time. returns Called after all the JavaScript has been executed.

Implementation

@Deprecated(r'Replaced by $(ref:scripting.executeScript) in Manifest V3.')
Future<List<Object>?> executeScript(
  int? tabId,
  InjectDetails details,
) async {
  var $res = await promiseToFuture<JSArray?>($js.chrome.tabs.executeScript(
    tabId,
    details.toJS,
  ));
  return $res?.toDart.cast<JSAny>().map((e) => e.dartify()!).toList();
}