Function

JSObjectMakeTypedArrayWithBytesNoCopy(_:_:_:_:_:_:_:)

Creates a JavaScript Typed Array object from an existing pointer.

Declaration

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

Parameters

ctx

The execution context to use.

arrayType

A value identifying the type of array to create. If arrayType is kJSTypedArrayTypeNone or kJSTypedArrayTypeArrayBuffer then NULL will be returned.

bytes

A pointer to the byte buffer to be used as the backing store of the Typed Array object.

byteLength

The number of bytes pointed to by the parameter bytes.

bytesDeallocator

The allocator to use to deallocate the external buffer when the JSTypedArrayData object is deallocated.

deallocatorContext

A pointer to pass back to the deallocator.

exception

A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.

Return Value

A JSObjectRef Typed Array whose backing store is the same as the one pointed to by bytes or NULL if there was an error.

Discussion

If an exception is thrown during this function the bytesDeallocator will always be called.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software