ArrayBufferView.fromBytes() for JS target

So, haxe.io.ArrayBufferView.fromBytes() does not exist for JS target as per docs (and source code, ofc): haxe.io.ArrayBufferView - Haxe 4.3.7 API

Given how fromBytes() is implemented: haxe/std/haxe/io/ArrayBufferView.hx at e0b355c6be312c1b17382603f018cf52522ec651 · HaxeFoundation/haxe · GitHub , could we have something similar for JS target?

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 can be used to implement fromBytes for JS in similar way it is in the source link above, i.e.:

  public static function fromBytes(bytes:haxe.io.Bytes, pos = 0, ?length:Int):ArrayBufferView {
    if (length == null)
      length = bytes.length - pos;
    if (pos < 0 || length < 0 || pos + length > bytes.length)
      throw haxe.io.Error.OutsideBounds;
    return ArrayBufferView.fromData(haxe.io.UInt8Array.fromBytes(bytes, pos, length).getData());
  }

I’m aware that 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.

What would be the issue with this code to warrant not including it in haxe/std/js/_std/haxe/io/ArrayBufferView.hx? Or maybe it would be easier to answer: why don’t we have fromBytes for JS target?

Checkout the typedarray implementation here, this is designed to better align with JS

I think the answer is down to time available to implement in the stdlib, I imagine a PR would be welcome