JSValue class

Implemented types
Mixed-in types
  • AutoDisposeFinalizer
Available extensions

Constructors

JSValue(JSContext _ctx, JSValueRef _ref, {JSValueUnionRef? union, String? str, bool autoDispose = true})
JSValue.alloc(JSContext ctx, JSTag tag, {int? int32, double? float64, Uint8List? list, Pointer<Void>? ptr, bool autoDispose = true})
factory
JSValue.atom_(JSContext ctx, int atom, {bool autoDispose = true})
factory
JSValue.EXCEPTION(JSContext ctx, {bool autoDispose = true})
factory
JSValue.FALSE(JSContext ctx, {bool autoDispose = true})
factory
JSValue.makeBigInt64(JSContext ctx, int v, {bool autoDispose = true})
factory
JSValue.makeBigUint64(JSContext ctx, int v, {bool autoDispose = true})
factory
JSValue.makeException(JSContext ctx, {bool autoDispose = true})
alloc EXCEPTION
factory
JSValue.makeFalse(JSContext ctx, {bool autoDispose = true})
factory
JSValue.makeNull(JSContext ctx, {bool autoDispose = true})
factory
JSValue.makeStringCodeUnits(JSContext ctx, String str, {bool autoDispose = true})
factory
JSValue.makeTrue(JSContext ctx, {bool autoDispose = true})
factory
JSValue.makeUndefined(JSContext ctx, {bool autoDispose = true})
factory
JSValue.makeUninitialized(JSContext ctx, {bool autoDispose = true})
factory
JSValue.NULL(JSContext ctx, {bool autoDispose = true})
factory
JSValue.obj(JSContext ctx, {bool autoDispose = true})
JS_NewObject
factory
JSValue.ptr(JSContext _ctx, JSValue_ v, {bool autoDispose = true})
JSValue.TRUE(JSContext ctx, {bool autoDispose = true})
factory
JSValue.UNDEFINED(JSContext ctx, {bool autoDispose = true})
factory
JSValue.UNINITIALIZED(JSContext ctx, {bool autoDispose = true})
factory
JSValue.newArray(JSContext ctx, {bool autoDispose = true})
factory
JSValue.newArrayBuffer(JSContext _ctx, Uint8List buf, {JSFreeArrayBufferDataFunc? freeFunc, Uint8List? user_data, int isShared = 0, bool autoDispose = true})
JSValue.newArrayBufferCopy(JSContext ctx, Uint8List buf, int len, {bool autoDispose = true})
JS_NewArrayBufferCopy
factory
JSValue.newAtomLenStr(JSContext _ctx, String str, {bool autoDispose = true})
JS_NewAtomLen
JSValue.newAtomStr(JSContext _ctx, String str, {bool autoDispose = true})
JS_NewAtom
JSValue.newAtomString(JSContext _ctx, String str, {bool autoDispose = true})
JS_NewAtomString
JSValue.newAtomUint32(JSContext _ctx, int val, {bool autoDispose = true})
JS_AtomToValue
JSValue.newCFunction2(JSContext _ctx, JSCFunction func, String name, int len, int cproto, int magic, {bool autoDispose = true})
JSValue.newCFunctionData(JSContext _ctx, JSCFunctionData func, int len, int magic, int dataLen, JSValueRef data, {bool autoDispose = true})
JSValue.newError(JSContext ctx, String errorStr, {bool autoDispose = true})
factory
JSValue.newObjectClass(JSContext ctx, int classId, {bool autoDispose = true})
JS_NewObjectClass
factory
JSValue.newObjectProto(JSContext ctx, JSValue proto, {bool autoDispose = true})
JS_NewObjectProto
factory
JSValue.newObjectProtoClass(JSContext ctx, JSValue proto, int classId, {bool autoDispose = true})
JS_NewObjectProtoClass
factory
JSValue.newPromiseCapability(JSContext ctx, List<JSValue> resolvingFuncs, {bool autoDispose = true})
resolvingFuncs represent resolve or reject function. JS_NewPromiseCapability resolvingFuncs need keep in memory.
factory
JSValue.newString(JSContext _ctx, String str, {bool autoDispose = true})
JS_NewString

Properties

atom → int
no setter
ctx → JSContext
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasRefCount → bool
no setter
isArray → bool
no setter
isAtom → bool
no setter
isBigDecimal → bool
no setter
isBigFloat → bool
no setter
isBigInt → bool
no setter
isBool → bool
no setter
isConstructor → bool
no setter
isDate → bool
no setter
isError → bool
no setter
isException → bool
no setter
isExtensible → bool
no setter
isFunction → bool
no setter
isModule → bool
no setter
isNull → bool
no setter
isNumber → bool
no setter
isObject → bool
no setter
isPromise → bool
no setter
isPromisePending → bool
no setter
isPromiseRejected → bool
no setter
isPromiseResolved → bool
no setter
isRegExp → bool
no setter
isString → bool
no setter
isSymbol → bool
no setter
isUndefined → bool
no setter
isUninitialized → bool
no setter
nativeFinalizer ↔ NativeFinalizer?
dart 对象回收器
getter/setter pairinherited
promiseResult → JSValue
no setter
ref → JSValueRef
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
string → String?
no setter
toBigInt64 → int?
no setter
toBool → bool
no setter
toCString → String?
reference quickjs.h 705 JS_ToCString static inline const Utf8NullTerminated *JS_ToCString(JSContext *ctx, JSValueConst val1) { return JS_ToCStringLen2(ctx, NULL, val1, 0); } 对应 JS_FreeCString, release 请调用 freeCStringPairPtr 释放 _cstrMap 缓存的 native 指针
no setter
toFloat64 → double?
no setter
toIndex → int?
no setter
toInt32 → int?
no setter
toInt64 → int?
no setter
toInt64Ext → int?
no setter

Methods

attach(Pointer<NativeFinalizerFunction> callback, Pointer<Void> token, {bool autoDispose = true, Object? detach, int? externalSize}) → dynamic
将引擎持有的指针和 dart 对象回收器绑定。确保 dart 对象销毁的时候,释放引擎持有的指针和资源
inherited
callConstructor({List<JSValue>? argv, bool autoDispose = true}) → JSValue
callConstructor2(JSValue newTarget, {List<JSValue>? argv, bool autoDispose = true}) → JSValue
callFunction({List<JSValue>? argv, JSValue? thiz, bool autoDispose = true}) → JSValue
defineProperty(int prop, JSValue getter, JSValue setter, JSProp flags, {JSValue? thiz}) → bool
definePropertyGetSet(int prop, JSValue getter, JSValue setter, JSProp flags) → bool
definePropertyValue(int prop, JSProp flags, {JSValue? thiz}) → bool
definePropertyValueStr(String prop, JSValue value, {JSProp? flags}) → bool
definePropertyValueUint32(int idx, JSValue item, {JSProp? flags}) → bool
deleteProperty(int prop, JSProp flags) → bool
detach() → dynamic
将引擎持有的指针和资源释放
inherited
detachArrayBuffer() → void
dumpError() → String?
dupAtom({bool autoDispose = true}) → JSValue
dupValue({bool autoDispose = true}) → JSValue
dupValueRT({bool autoDispose = true}) → JSValue
free() → void
freeCString(Pointer<Utf8> ptr) → void
freeCStringPairPtr(String? str) → void
freeRT(JSRuntime rt) → void
freeValue() → dynamic
getArrayBuffer() → Uint8List?
getOpaque(int classId) → Pointer<Void>
getOpaque2(int classId) → Pointer<Void>
getOwnProperty(JSPropertyDescriptor desc, int prop) → bool
getOwnPropertyNames({JSGN? flags}) → (List<JSPropertyEnum>?, int?)
getPropertyInternal(int prop, JSValue receiver, int throwRefError, {bool autoDispose = true}) → JSValue
getPropertyStr(String prop, {bool autoDispose = true}) → JSValue
getPropertyUint32(int idx, {bool autoDispose = true}) → JSValue
getPrototype({bool autoDispose = true}) → JSValue
getTypedArrayBuffer({Pointer<Size>? pbytesPerElement, bool autoDispose = true}) → (JSValue, int, int)
hasProperty(int prop) → bool
isBothFloat(JSValue other) → bool
isBothInt(JSValue other) → bool
isInstanceOf(JSValue other) → bool
JSONStringify({JSValue? replacer, JSValue? space0, bool autoDispose = true}) → JSValue
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preventExtensions() → bool
setOpaque(Pointer<Void> opaque) → void
setPropertyFunctionList(List<JSCFunctionListEntry> tab) → void
setPropertyInt64(int idx, JSValue val) → bool
setPropertyInternal(int prop, JSValue val, JSValue thiz, JSProp flags) → bool
setPropertyStr(String prop, JSValue val) → bool
setPropertyUint32(int idx, JSValue val) → bool
setPrototype(JSValue protoVal) → bool
stringify({bool autoDispose = true}) → JSValue
toDart() → dynamic

Available on JSValue, provided by the JSValueToNative extension

toPropertyKey() → JSValue
JS_ToPropertyKey
toString() → String
A string representation of this object.
inherited

Operators

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