Contents

JSObjectMakeArrayBufferWithBytesNoCopy(_:_:_:_:_:_:)

Creates a JavaScript array buffer object from an existing pointer.

Declaration

func JSObjectMakeArrayBufferWithBytesNoCopy(_ ctx: JSContextRef!, _ bytes: UnsafeMutableRawPointer!, _ byteLength: Int, _ bytesDeallocator: JSTypedArrayBytesDeallocator!, _ deallocatorContext: UnsafeMutableRawPointer!, _ exception: UnsafeMutablePointer<JSValueRef?>!) -> JSObjectRef!

Parameters

  • ctx:

    The execution context to use.

  • bytes:

    A pointer to the byte buffer to use as the backing store of the typed array object.

  • byteLength:

    The number of bytes that bytes points to.

  • bytesDeallocator:

    The allocator to use to deallocate the external buffer when deallocating the typed array object.

  • deallocatorContext:

    A pointer to pass back to the deallocator.

  • exception:

    A pointer to a Jsvalueref to store an exception in, if any. Pass NULL to discard any exception.

Return Value

A JSObjectRef array buffer with a backing store that is the same as the one that bytes points to, or NULL if there is an error.

Discussion

If the system throws an exception during this function, it always calls the bytesDeallocator.

See Also

Working with Array Buffers