executeScript method
- @Deprecated(r'Replaced by scripting.executeScript in Manifest V3.')
- int? tabId,
- 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 Resolves after all the JavaScript has been executed.
Implementation
@Deprecated(r'Replaced by scripting.executeScript in Manifest V3.')
Future<List<Object>?> executeScript(
int? tabId,
InjectDetails details,
) async {
var $res = await $js.chrome.tabs
.executeScript(
tabId,
details.toJS,
)
.toDart;
return $res?.toDart.cast<JSAny>().map((e) => e.dartify()!).toList();
}