JSObject.makeTypedArrayWithBytesNoCopy constructor
JSObject.makeTypedArrayWithBytesNoCopy(
- JSContext context, {
- required JSTypedArrayType arrayType,
- required JSTypedArrayBytes bytes,
- Pointer<
NativeFunction< ? bytesDeallocator,JSTypedArrayBytesDeallocator> > - required Pointer<
Void> deallocatorContext,
Implementation
factory JSObject.makeTypedArrayWithBytesNoCopy(
JSContext context, {
required JSTypedArrayType arrayType,
required JSTypedArrayBytes bytes,
Pointer<NativeFunction<js_bd.JSTypedArrayBytesDeallocator>>? bytesDeallocator,
required Pointer<Void> deallocatorContext,
}) {
final JSException exception = JSException.create(context);
try {
final JSObject object = JSObject(
context,
js_bd.JSObjectMakeTypedArrayWithBytesNoCopy(
context.ref,
JSTypedArrayType.values.indexOf(arrayType),
bytes.bytes,
bytes.length,
bytesDeallocator ?? nullptr,
deallocatorContext,
exception.ref,
),
);
if (exception.shouldThrow) {
throw exception.error;
}
return object;
} finally {
exception.release();
}
}