ArrayBuffer support

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

Post Reply
User avatar
Rob
Posts: 53
Joined: 01 Jul 2017, 07:33

ArrayBuffer support

Post by Rob »

Is regular js Arrays the only accepted type to interact with SFSDataType.BYTE_ARRAY in SFSArrays/SFSObjects?

If so, I'd like to suggest you add ArrayBuffer (or at least a typed array) as a valid type as well in order to avoid unnecessary data conversions when the original data is already in ArrayBuffer format.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ArrayBuffer support

Post by Lapo »

Hello,
yes I think you're right. The current version of the API is representing byte arrays as number arrays which is unoptimized.
Instead we could improve both putByteArray() and getByteArray() using the Uint8Array JS type, to keep memory usage in check and restrict types to actual bytes.

Makes sense?
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Rob
Posts: 53
Joined: 01 Jul 2017, 07:33

Re: ArrayBuffer support

Post by Rob »

Yes that sounds like a good improvement.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ArrayBuffer support

Post by Lapo »

Okay, we'll prepare a new release during the week.
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ArrayBuffer support

Post by Lapo »

UPDATE:
we've released the update for the Javascript API.
https://forums.smartfoxserver.com/viewt ... 33&t=20902

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply