JSObject.makeTypedArray constructor

JSObject.makeTypedArray(
  1. JSContext context,
  2. JSTypedArrayType arrayType,
  3. int length, {
  4. JSValuePointer? exception,
})

Creates a JavaScript Typed Array object with the given number of elements. arrayType A value JSTypedArrayType identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. length (size_t) The number of elements to be in the new Typed Array. 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.

Implementation

JSObject.makeTypedArray(
  this.context,
  JSTypedArrayType arrayType,
  int length, {
  JSValuePointer? exception,
}) : this.pointer = JSTypedArray.jSObjectMakeTypedArray(
          context.pointer,
          JSValue.jSTypedArrayTypeToCEnum(arrayType),
          length,
          (exception ?? JSValuePointer(nullptr)).pointer);