Skip to content

Conversation

zagortenej
Copy link
Contributor

haxe.io.ArrayBufferView.fromBytes() does not exist for JS target as per docs (and source code, ofc): https://api.haxe.org/haxe/io/ArrayBufferView.html

This PR implements fromBytes() for JS target based on how fromBytes() is implemented in /std/haxe/io/ArrayBufferView:

public static function fromBytes(bytes:haxe.io.Bytes, pos = 0, ?length:Int):ArrayBufferView {
.

ArrayBufferViewData for JS target is js.lib.ArrayBufferView which is a helper representing JS TypedArray. Uint8Array is one of the native JS typed arrays, and Haxe UInt8ArrayData has been used to implement fromBytes for JS in similar way it is in the source link above.

UInt8ArrayData for JS target does not unify with ArrayBufferViewImpl from the source link above, however the implementation in this post seems to work on JS target in my tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant