JSObjectCallAsConstructorCallback typedef

Pointer<NativeType> JSObjectCallAsConstructorCallback (
  1. Pointer<NativeType> ctx,
  2. Pointer<NativeType> constructor,
  3. Uint32 argumentCount,
  4. Pointer<Pointer<NativeType>> arguments,
  5. Pointer<Pointer<NativeType>> exception
)

typedef JSObjectCallAsConstructorCallback The callback invoked when an object is used as a constructor in a 'new' expression. ctx The execution context to use. constructor A JSObject that is the constructor being called. argumentCount An integer count of the number of arguments in arguments. arguments A JSValue array of the arguments passed to the function. exception A pointer to a JSValueRef in which to return an exception, if any. @result A JSObject that is the constructor's return value. If you named your function CallAsConstructor, you would declare it like this:

JSObjectRef CallAsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);

If your callback were invoked by the JavaScript expression 'new myConstructor()', constructor would be set to myConstructor.

If this callback is NULL, using your object as a constructor in a 'new' expression will throw an exception. typedef JSObjectRef (JSObjectCallAsConstructorCallback) (JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef exception);

Implementation

typedef JSObjectCallAsConstructorCallback = Pointer Function(
    Pointer ctx,
    Pointer constructor,
    Uint32 argumentCount,
    Pointer<Pointer> arguments,
    Pointer<Pointer> exception);