JSObject.makeConstructor constructor
JSObject.makeConstructor(
- JSContext context,
- JSClass jsClass,
- Pointer<
NativeFunction< ? callAsConstructorJSObjectCallAsConstructorCallback> >
Convenience method for creating a JavaScript constructor.
The default object constructor takes no arguments and constructs an object of class jsClass with no private data.
jsClass
A JSClass that is the class your constructor will assign to the objects its constructs. jsClass will be used to set the constructor's .prototype property, and to evaluate 'instanceof' expressions. Pass NULL to use the default object class.
callAsConstructor
A JSObjectCallAsConstructorCallback to invoke when your constructor is used in a 'new' expression. Pass NULL to use the default object constructor.
Implementation
JSObject.makeConstructor(
this.context,
JSClass jsClass,
Pointer<NativeFunction<JSObjectRef.JSObjectCallAsConstructorCallback>>?
callAsConstructor)
: this.pointer = JSObjectRef.jSObjectMakeConstructor(
context.pointer, jsClass.pointer, callAsConstructor ?? nullptr);