evaluate<T> method
If the function passed to the Frame.evaluate returns a Promise
, then
Frame.evaluate would wait for the promise to resolve and return its value.
If the function passed to the Frame.evaluate returns a non-Serializable
value, then Frame.evaluate
resolves to null.
DevTools Protocol also supports transferring some additional values that
are not serializable by JSON
: -0
, NaN
, Infinity
, -Infinity
, and
bigint literals.
Shortcut for (await worker.executionContext).evaluate
.
Parameters:
pageFunction
Function to be evaluated in the page contextargs
Arguments to pass topageFunction
- Returns: Future which resolves to the return value of
pageFunction
Implementation
Future<T?> evaluate<T>(@Language('js') String pageFunction,
{List<dynamic>? args}) async {
return (await executionContext).evaluate<T>(pageFunction, args: args);
}