altmp / altv-js-module-v2

alt:V JavaScript v2 module
MIT License
10 stars 9 forks source link

fix typed array mvalue serialization #244

Closed xxshady closed 3 months ago

xxshady commented 3 months ago

For some reason HasBuffer doesn't work as it should and according to MDN docs buffer is readonly and should always present in TypedArray

alt.Events.on('test', (...data) => {
  alt.log({ data })
})
alt.Events.emit('test', new Uint8Array([1, 2, 3]))

before: { data: [ undefined ] }

after:

{
  data: [
    ArrayBuffer {
      [Uint8Contents]: <01 02 03>,
      byteLength: 3
    }
  ]
}