introduce js.createTypedArray

A new way to create typed arrays that allows using the same memory.
This commit is contained in:
Halil Durak
2026-02-17 01:45:19 +03:00
parent f80566e0cb
commit c30207ac63
3 changed files with 77 additions and 42 deletions

View File

@@ -306,6 +306,14 @@ pub fn zigValueToJs(self: *const Local, value: anytype, comptime opts: CallOpts)
js.Value => return value,
js.Exception => return .{ .local = self, .handle = isolate.throwException(value.handle) },
js.ArrayBufferRef(.Int8), js.ArrayBufferRef(.Uint8), js.ArrayBufferRef(.Uint8Clamped),
js.ArrayBufferRef(.Int16), js.ArrayBufferRef(.Uint16),
js.ArrayBufferRef(.Int32), js.ArrayBufferRef(.Uint32),
js.ArrayBufferRef(.Float16), js.ArrayBufferRef(.Float32), js.ArrayBufferRef(.Float64),
=> {
return .{ .local = self, .handle = value.internal };
},
inline
js.Function,
js.Object,