JsRuntime class final

A long-lived QuickJS runtime that can host isolated JavaScript contexts.

Native platforms place child contexts in one shared JSRuntime. Backends without multi-context support preserve the same isolation contract by creating an independent backend runtime for each context.

Properties

activeContextCount int
Number of live child contexts, primarily useful for capacity diagnostics.
no setter
closed bool
Runtime 是否已经进入关闭状态。
no setter
engineVersion String
底层 JavaScript Engine 的版本字符串。
no setter
hashCode int
The hash code for this object.
no setterinherited
options JsOptions
创建此 Runtime 时应用的资源与队列限制。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createContext({JsModuleLoader? moduleLoader, List<JsScript> scripts = const <JsScript>[], List<JsModule> modules = const <JsModule>[], List<JsHostMethod> methods = const <JsHostMethod>[], List<JsFeatures> features = const <JsFeatures>[], List<JsPlugin> plugins = const <JsPlugin>[], JsConsoleSink? onConsole}) Future<JsContext>
Creates a context with an independent global object and module registry.
dispose() Future<void>
关闭所有子 Context 并释放底层 Runtime;重复调用返回同一 Future。
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

create({JsOptions options = const JsOptions()}) Future<JsRuntime>
创建一个可承载多个隔离 Context 的长期 Runtime。