JSGlobalContext class
Constructors
- JSGlobalContext.new(JSContextRef ref)
- JSGlobalContext.create({JSClass? globalObjectClass})
-
Creates a global JavaScript execution context.
JSGlobalContextCreate allocates a global object and populates it with all the
built-in JavaScript objects, such as Object, Function, String, and Array.
factory
- JSGlobalContext.createInGroup({JSContextGroup? group, JSClass? globalObjectClass})
-
Creates a global JavaScript execution context in the context group provided.
JSGlobalContextCreateInGroup allocates a global object and populates it with
all the built-in JavaScript objects, such as Object, Function, String, and Array.
group
(JSContextGroup) The context group to use. The created global context retains the group. Pass NULL to create a unique group for the context.globalObjectClass
(JSClass) The class to use when creating the global object. Pass NULL to use the default object class.@result
(JSGlobalContext) A JSGlobalContext with a global object of class globalObjectClass and a context group equal to group.factory
Properties
- globalContext → JSGlobalContext
-
Gets the global context of a JavaScript execution context.
@result
(JSGlobalContext) ctx's global context.no setterinherited - globalObject → JSObject
-
Gets the global object of a JavaScript execution context.
@result
(JSObject) ctx's global object.no setterinherited - group → JSContextGroup
-
Gets the context group to which a JavaScript execution context belongs.
@result
(JSContextGroup) ctx's group.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- nativeFinalizer ↔ NativeFinalizer?
-
dart 对象回收器
getter/setter pairinherited
- ref → JSContextRef
-
no setterinherited
- 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 -
inherited
-
copyName(
) → String? -
Gets a copy of the name of a context.
A JSGlobalContext's name is exposed for remote debugging to make it
easier to identify the context you would like to attach to.
@result
(String) The name for ctx. -
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.inherited -
free(
) → void -
Releases a global JavaScript execution context.
ctx
(JSGlobalContext) The JSGlobalContext to release. -
gc(
) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
retain(
) → JSGlobalContext -
Retains a global JavaScript execution context.
@result
(JSGlobalContext) A JSGlobalContext that is the same as ctx. -
setInspectable(
bool inspectable) → void -
setName(
String name) → void -
Sets the remote debugging name for a context.
name
(JSString) The remote debugging name to set on ctx. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited