JSObject.makeTypedArrayWithArrayBuffer constructor

JSObject.makeTypedArrayWithArrayBuffer(
  1. JSContext context,
  2. JSTypedArrayType arrayType,
  3. JSObject buffer, {
  4. JSValuePointer? exception,
})

Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object. arrayType A value JSTypedArrayType identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. buffer An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object. 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.makeTypedArrayWithArrayBuffer(
  this.context,
  JSTypedArrayType arrayType,
  JSObject buffer, {
  JSValuePointer? exception,
}) : this.pointer = JSTypedArray.jSObjectMakeTypedArrayWithArrayBuffer(
          context.pointer,
          JSValue.jSTypedArrayTypeToCEnum(arrayType),
          buffer.pointer,
          (exception ?? JSValuePointer(nullptr)).pointer);