JSObject.makeArrayBufferWithBytesNoCopy constructor

JSObject.makeArrayBufferWithBytesNoCopy(
  1. JSContext context,
  2. Bytes bytes,
  3. Pointer<NativeFunction<JSTypedArrayBytesDeallocator>>? bytesDeallocator,
  4. Pointer<NativeType> deallocatorContext, {
  5. JSValuePointer? exception,
})

Creates a JavaScript Array Buffer object from an existing pointer. If an exception is thrown during this function the bytesDeallocator will always be called. bytes (void*) A pointer to the byte buffer to be used as the backing store of the Typed Array object. bytesDeallocator (JSTypedArrayBytesDeallocator) The allocator to use to deallocate the external buffer when the Typed Array data object is deallocated. deallocatorContext (void*) A pointer to pass back to the deallocator. 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.makeArrayBufferWithBytesNoCopy(
  this.context,
  Bytes bytes,
  Pointer<NativeFunction<JSBase.JSTypedArrayBytesDeallocator>>?
      bytesDeallocator,
  Pointer deallocatorContext, {
  JSValuePointer? exception,
}) : this.pointer = JSTypedArray.jSObjectMakeArrayBufferWithBytesNoCopy(
          context.pointer,
          bytes.pointer,
          bytes.length,
          bytesDeallocator ?? nullptr,
          deallocatorContext,
          (exception ?? JSValuePointer(nullptr)).pointer);