matter.js icon indicating copy to clipboard operation
matter.js copied to clipboard

Trivial: ByteArray thoughts

Open lauckhart opened this issue 1 year ago • 1 comments

Some quick ideas r.e. ByteArray.

  • Right now we monkeypatch Uint8Array, might be frowned upon by some library users
  • Could we make ByteArray a subclass of Uint8Array instead of an alias, and put utility functions there?
  • We could also add custom toString and toJSON methods so diagnostics like in #138 would show as hex rather than comma-separated decimal
  • I could also add the base64 utilities using the codec I made for the security stuff

lauckhart avatar May 21 '23 19:05 lauckhart

@mfucci introduced it that way. I think the idea was that on other platforms it might nbe something else then UInt8Array, thats why "just" the alias.

@mfucci Any opinion on this?

Apollon77 avatar May 21 '23 20:05 Apollon77