JSClassDefinition class
struct JSStaticFunction This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time.
If you named your getter function "GetX" and your setter function "SetX", you would declare a JSStaticValue array containing "X" like this:
JSStaticValue StaticValueArray[] = { Standard JavaScript practice calls for storing function objects in prototypes, so they can be shared. The default JSClass created by JSClassCreate follows this idiom, instantiating objects with a shared, automatically generating prototype containing the class's function objects. The kJSClassAttributeNoAutomaticPrototype attribute specifies that a JSClass should not automatically generate such a prototype. The resulting JSClass instantiates objects with the default object prototype, and gives each instance object its own copy of the class's function objects.
- Implemented types
- Mixed-in types
-
- AutoDisposeFinalizer
Constructors
-
JSClassDefinition.new(JSClassDefinitionRef _ref, {List<
JSStaticVale> ? staticValues, List<JSStaticFunction> ? staticFunctions, bool autoDispose = true}) -
JSClassDefinition.create({int version = 0, JSClassAttributes attributes = JSClassAttributes.kJSClassAttributeNone, required String className, JSClass? parentClass, List<
JSStaticVale> ? staticValues, List<JSStaticFunction> ? staticFunctions, JSObjectInitializeCallback? initialize, JSObjectFinalizeCallback? finalize, JSObjectHasPropertyCallback? hasProperty, JSObjectGetPropertyCallback? getProperty, JSObjectSetPropertyCallback? setProperty, JSObjectDeletePropertyCallback? deleteProperty, JSObjectGetPropertyNamesCallback? getPropertyNames, JSObjectCallAsConstructorCallback? callAsConstructor, JSObjectCallAsFunctionCallback? callAsFunction, JSObjectHasInstanceCallback? hasInstance, JSObjectConvertToTypeCallback? convertToType})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- nativeFinalizer ↔ NativeFinalizer?
-
dart 对象回收器
getter/setter pairinherited
- ref → JSClassDefinitionRef
-
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
-
detach(
) → dynamic -
将引擎持有的指针和资源释放
inherited
-
free(
) → void -
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