JSContext class

A JavaScript execution context. Holds the global object and other execution state.

Implemented types
Mixed-in types
  • AutoDisposeFinalizer
Implementers

Constructors

JSContext.new(JSContextRef _ref, {bool autoDispose = true})

Properties

globalContext JSGlobalContext
Gets the global context of a JavaScript execution context. @result (JSGlobalContext) ctx's global context.
no setter
globalObject JSObject
Gets the global object of a JavaScript execution context. @result (JSObject) ctx's global object.
no setter
group JSContextGroup
Gets the context group to which a JavaScript execution context belongs. @result (JSContextGroup) ctx's group.
no setter
hashCode int
The hash code for this object.
no setteroverride
nativeFinalizer NativeFinalizer?
dart 对象回收器
getter/setter pairinherited
ref JSContextRef
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

attach(Pointer<NativeFinalizerFunction> callback, Pointer<Void> token, {bool autoDispose = true, Object? detach, int? externalSize}) → dynamic
将引擎持有的指针和 dart 对象回收器绑定。确保 dart 对象销毁的时候,释放引擎持有的指针和资源
inherited
checkScriptSyntax(String script, {String? sourceURL, int startingLineNumber = 1}) bool
detach() → dynamic
将引擎持有的指针和资源释放
inherited
evaluate(String script, {JSObject? thisObject, String? sourceURL, int startingLineNumber = 1}) JSValue
Evaluates a string of JavaScript. script (String) A JSString containing the script to evaluate. thisObject (JSObject) The object to use as "this," or NULL to use the global object as "this." sourceURL (String) A JSString containing a URL for the script's source file. This is used by debuggers and when reporting exceptions. Pass NULL if you do not care to include source file information. startingLineNumber (int) An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. The value is one-based, so the first line is line 1 and invalid values are clamped to 1. @result (JSValueRef) The JSValue that results from evaluating script, or NULL if an exception is thrown.
gc() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override