📜 ⬆️ ⬇️

C-like structures in javascript

In this article I want to talk about a small library that simplifies working with binary data structures and arrays from C / C ++ in JavaScript code.

In the article about the universal interface, I talked about the benefits of using a Web-socket. The only uncomfortable point in the development process for me was the exchange of data between JavaScript and C / C ++ code. The first thing that occurred to me was to use JSON objects, which can be very easily generated and interpreted in Qt. However, in practice it was not a very convenient solution. You need to constantly wrap data structures from C / C ++ into JSON objects, and then also expand them. Agree, not the most pleasant thing.

After a while I began to dream. But I would be able to transfer the “sishny” structure directly to JavaScript and back, without any JSON objects and other gestures. Searching a little on the Internet, I came across a Mozilla tree . Due to the significant number of limitations of this library, I refused to use it.

After a deeper acquaintance with typed arrays in JavaScript and web sockets, I decided to write the library of my dreams, with “documentation and examples”. As you probably guessed, I wrote this library and want to hear feedback from professionals.
')
For exploring the library, welcome to my github .

Source: https://habr.com/ru/post/273275/


All Articles