C-like structures in JavaScript

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

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

After some time, I began to dream. But I should be able to directly transfer the structure to JavaScript and vice versa, without any JSON objects and other body movements. Searching a bit on the expanses of the Internet, I came across a d tree Mozilla. 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 my dream library, with “documentation and examples”. As you probably guessed, I wrote this library and I want to hear reviews from professionals.

To get acquainted with the library of grace, I ask in my github .

Only registered users can participate in the survey. Please come in.

What are the potential flaws of the presented library?

Also popular now: