callAsConstructor method

JSObject callAsConstructor(
  1. JSValuePointer arguments, {
  2. JSValuePointer? exception,
})

Calls an object as a constructor. arguments (JSValueRef[]) A JSValue array of arguments to pass to the constructor. Pass NULL if argumentCount is 0. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception. @result (JSObjectRef) The JSObject that results from calling object as a constructor, or NULL if an exception is thrown or object is not a constructor.

Implementation

JSObject callAsConstructor(
  JSValuePointer arguments, {
  JSValuePointer? exception,
}) {
  return JSObject(
      context,
      JSObjectRef.jSObjectCallAsConstructor(
          context.pointer,
          pointer,
          arguments.count,
          arguments.pointer,
          (exception ?? JSValuePointer(nullptr)).pointer));
}