raylib-wasm-transpiler/tools/js-class-c-struct-transpiler/test/build/LoginRequest.js

45 lines
1.2 KiB
JavaScript

import Login from "./Login"
/**
* @typedef {Object} LoginRequest a request for a login
* @property Login Login user login info
*/
class LoginRequest {
/**
* user login info
* @return {Login} gets the value of Login
*/
get Login() {
return new Login({}, new Uint8Array(this._ptr.slice(0, 320)));
}
/**
* user login info
* @param {Login} sets the value of Login
*/
set Login(v) {
this._data.set(v.bytes(), 0);
}
/**
* Get the struct representation of the object
* @return {Uint8Array} u8 array of the C struct.
*/
get bytes() {
return new Uint8Array(this._ptr);
}
/**
* Constructs a new LoginRequest
*
* @param {{Login: Login, }} init The arguments to construct the object.
* @param {ArrayBuffer} ptr The pointer to the C struct.
*/
constructor(init = {}, ptr = undefined) {
this._size = 320;
this._ptr = ptr?.buffer || new ArrayBuffer(this._size);
this._data = new DataView(this._ptr);
for (const key of Object.keys(init)) {
this[key] = init[key];
}
}
}
export default LoginRequest