JSInterpreter class
Main JavaScript engine
Constructors
Properties
-
consoleOutput
→ List<
String> -
Console output buffer for bytecode mode
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isModuleMode → bool
-
Check if currently in module mode
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearMessageSystem(
) → void - Clears all channels and callbacks
-
createRealmFunction(
) → JSNativeFunction - Creates a createRealm function that can be used in JavaScript This implements $262.createRealm() for test262 tests
-
enableNotAFunctionTracing(
[bool enabled = true]) → void - Emits a debug trace to consoleOutput when a non-callable value is invoked.
-
eval(
String code) → JSValue - Evaluates a JavaScript code string Maintains state between evaluations
-
evalAsync(
String code) → Future< JSValue> - Evaluates a JavaScript code string asynchronously If the result is a JavaScript Promise, returns a Dart Future that resolves when the JS Promise resolves
-
evalAsyncToDart(
String code) → dynamic - Evaluates a JavaScript expression asynchronously and returns the Dart value
-
evalExpression(
String code) → JSValue - Evaluates a simple JavaScript expression
-
evalExpressionToDart(
String code) → dynamic - Evaluates an expression and returns the Dart value
-
evalToDart(
String code) → dynamic - Evaluates a JavaScript expression and returns the Dart value
-
getChannels(
) → List< String> - Returns the list of registered channels
-
getGlobal(
String name) → dynamic - Retrieves a global variable
-
getInterpreterInstanceId(
) → String -
hasGlobal(
String name) → bool - Checks if a global variable exists
-
loadModule(
String moduleId, [String? importer]) → Future< JSModule> - Preloads a module asynchronously
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMessage(
String channelName, dynamic callback(dynamic)) → void - Registers a callback to receive messages from a JavaScript channel
-
performHostGarbageCollection(
) → void - Runs the host-visible weak-reference collection step used by tests.
-
registerGlobal(
String name, JSValue value) → void - Registers a native function in the global environment
-
removeCallback(
String channelName, dynamic callback(dynamic)) → void - Removes a specific callback from a channel
-
removeChannel(
String channelName) → void - Removes all callbacks from a channel
-
runPendingAsyncTasks(
) → void - Manually executes pending asynchronous tasks (for tests)
-
setGlobal(
String name, dynamic value) → void - Defines a global variable
-
setModuleLoader(
Future< String> loader(String moduleId)) → void - Configures the module loader
-
setModuleMode(
bool isModule) → void - Set module mode - in module context, certain identifiers are restricted
-
setModuleResolver(
String resolver(String moduleId, String? importer)) → void - Configures the module resolver
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
channelFunctionsRegistered
→ Map<
String, Map< String, dynamic Function(dynamic arg)> > -
no setter