JSObject.makeTypedArrayWithArrayBufferAndOffset constructor

JSObject.makeTypedArrayWithArrayBufferAndOffset(
  1. JSContext context,
  2. JSTypedArrayType arrayType,
  3. JSObject buffer,
  4. int byteOffset,
  5. int length, {
  6. JSValuePointer? exception,
})

Creates a JavaScript Typed Array object from an existing JavaScript Array Buffer object with the given offset and length. arrayType A value JSTypedArrayType identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned. buffer (JSObjectRef) An Array Buffer object that should be used as the backing store for the created JavaScript Typed Array object. byteOffset (size_t) The byte offset for the created Typed Array. byteOffset should aligned with the element size of arrayType. length (size_t) The number of elements to include in the 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.makeTypedArrayWithArrayBufferAndOffset(
  this.context,
  JSTypedArrayType arrayType,
  JSObject buffer,
  int byteOffset,
  int length, {
  JSValuePointer? exception,
}) : this.pointer =
          JSTypedArray.jSObjectMakeTypedArrayWithArrayBufferAndOffset(
              context.pointer,
              JSValue.jSTypedArrayTypeToCEnum(arrayType),
              buffer.pointer,
              byteOffset,
              length,
              (exception ?? JSValuePointer(nullptr)).pointer);