JSContext class

Implemented types
Mixed-in types
  • AutoDisposeFinalizer
Available extensions

Constructors

JSContext(JSContextRef _ref, {bool intrinsic = false, bool autoDispose = true})
JSContext.create(JSRuntime rt, {bool intrinsic = false, bool autoDispose = true})
factory

Properties

exception → JSValue
no setter
globalObject → JSValue
no setter
hashCode → int
The hash code for this object.
no setterinherited
nativeFinalizer ↔ NativeFinalizer?
dart 对象回收器
getter/setter pairinherited
ref → JSContextRef
no setter
runtime → JSRuntime
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addIntrinsicBaseObjects() → void
addIntrinsicBigDecimal() → void
addIntrinsicBigFloat() → void
addIntrinsicBigInt() → void
addIntrinsicDate() → void
addIntrinsicEval() → void
addIntrinsicJSON() → void
addIntrinsicMapSet() → void
addIntrinsicOperators() → void
addIntrinsicPromise() → void
addIntrinsicProxy() → void
addIntrinsicRegExp() → void
addIntrinsicRegExpCompiler() → void
addIntrinsicStringNormalize() → void
addIntrinsicTypedArrays() → void
addModuleExport(JSModuleDefRef m, String name) → int
addModuleExportList(JSModuleDefRef m, Pointer<JSCFunctionListEntry_> tab, int len) → int
attach(Pointer<NativeFinalizerFunction> callback, Pointer<Void> token, {bool autoDispose = true, Object? detach, int? externalSize}) → dynamic
将引擎持有的指针和 dart 对象回收器绑定。确保 dart 对象销毁的时候,释放引擎持有的指针和资源
inherited
call(JSValue funcObj, {JSValue? thiz, int argc = 0, List<JSValue>? argv, bool autoDispose = true}) → JSValue
cleanException() → void
detach() → dynamic
将引擎持有的指针和资源释放
inherited
detectModule(String input, int len) → int
dup() → JSContext
enableBignumExt(int enable) → void
enqueJob(JSJobFunc jobFunc, {int argc = 0, List<JSValue>? argv}) → int
eval(String input, String filename, {JSEvalType evalFlags = JSEvalType.GLOBAL, bool autoDispose = true}) → JSValue
JSEvalType.MODULE | JSEvalType.COMPILE_ONLY : Compile then run to be able to set import.meta, then invoke js_module_set_import_meta(ctx, ret, TRUE, is_main) ret = JS_Eval(ctx, (Utf8 *) dbuf.buf, dbuf_size - 1, filename, JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY); if (!JS_IsException(ret)) { js_module_set_import_meta(ctx, ret, TRUE, is_main); ret = JS_EvalFunction(ctx, ret); }
evalBytecode(Uint8List buf) → bool

Available on JSContext, provided by the JSContextFunction extension

evalFunction(JSValue funObj, {bool autoDispose = true}) → JSValue
evalThis(JSValue thiz, String input, String filename, {JSEvalType evalFlags = JSEvalType.GLOBAL, bool autoDispose = true}) → JSValue
free() → void
freeCString(String ptr) → void
getClassProto(int classId, {bool autoDispose = true}) → JSValue
getImportMeta(JSModuleDefRef m, {bool autoDispose = true}) → JSValue
getModuleName(JSModuleDefRef m) → int
getOpaque() → Pointer<Void>
getRuntime({bool autoDispose = true}) → JSRuntime
getScriptOrModuleName(int nStackLevels) → int
initIntrinsic({bool baseObject = true, bool bigDecimal = true, bool bigFloat = true, bool bigInt = true, bool date = true, bool eval = true, bool json = true, bool mapSet = true, bool operators = true, bool promise = true, bool proxy = true, bool regexp = true, bool regexpCompiler = true, bool stringNormalize = true, bool typedArrays = true}) → void
invoke(int atom, {JSValue? thiz, int argc = 0, List<JSValue>? argv, bool autoDispose = true}) → JSValue
jsInitModuleOs(String moduleName) → JSModuleDefRef
jsInitModuleStd(String moduleName) → JSModuleDefRef
jsLoadFile(int bufLen, String filename) → Pointer<Uint8>
jsModuleLoader(String moduleName, Pointer<Void> opaque) → JSModuleDefRef
jsModuleSetImportMeta(JSValue funcVal, int useRealpath, int isMain) → int
JSONStringify(JSValue obj, {JSValue? replacer, JSValue? space0, bool autoDispose = true}) → JSValue
jsStdAddHelpers({int argc = 0, List<String>? argv}) → void
jsStdDumpError() → void
jsStdEvalBinary(Pointer<Uint8> buf, int len, int flags) → void
jsStdLoop() → void
jsStdPromiseRejectionTracker(JSValue promise, JSValue reason, int isHandled, Pointer<Void> opaque) → void
jsStdSetWorkerNewContextFunc(SetWorkerNewContextFunc? cb) → void
jsthrow(JSValue obj, {bool autoDispose = true}) → JSValue
newCModule(String name, Pointer<JSModuleInitFunc> func) → JSModuleDefRef
newError({bool autoDispose = true}) → JSValue
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseJSON(String buf, int len, String filename, {bool autoDispose = true}) → JSValue
parseJSON2(String buf, int len, String filename, int flags, {bool autoDispose = true}) → JSValue
readObject(Uint8List buf, int flags, {bool autoDispose = true}) → JSValue
resetUncatchableError() → void
resolveModule(JSValue obj) → bool
runModule(String basename, String filename) → JSModuleDefRef
setClassProto(int classId, JSValue obj) → void
setConstructor(JSValue funcObj, JSValue proto) → void
setConstructorBit(JSContext ctx, JSValue funcObj, int val) → int
setIsHTMLDDA(JSValue obj) → void
setModuleExport(JSModuleDefRef m, String exportName, JSValue val) → int
setModuleExportList(JSModuleDefRef m, Pointer<JSCFunctionListEntry_> tab, int len) → int
setOpaque(Pointer<Void> data) → void
throwInternalError(String fmt, {bool autoDispose = true}) → JSValue
throwOutOfMemory(String fmt, {bool autoDispose = true}) → JSValue
throwRangeError(String fmt, {bool autoDispose = true}) → JSValue
throwReferenceError(String fmt, {bool autoDispose = true}) → JSValue
throwSyntaxError(String fmt, {bool autoDispose = true}) → JSValue
throwTypeError(String fmt, {bool autoDispose = true}) → JSValue
toString() → String
A string representation of this object.
inherited
writeObject(Pointer<Size> psize, JSValue obj, int flags) → Pointer<Uint8>
writeObject2(Pointer<Size> psize, JSValue obj, int flags, Pointer<Pointer<Pointer<Uint8>>> psabTab, Pointer<Size> psabTabLen) → Pointer<Uint8>

Operators

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