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

42 lines
1.0 KiB
JavaScript

class Login {
/**
* Email of the user
*/
get Email() {
return this._decoder.decode(new Uint8Array(this._ptr.slice(0, 256)));
}
set Email(v) {
this._data.set(this._encoder.encode(v), 0);
}
/**
* Password of the user
*/
get Password() {
return this._decoder.decode(new Uint8Array(this._ptr.slice(256, 320)));
}
set Password(v) {
this._data.set(this._encoder.encode(v), 256);
}
/**
* get the struct representation of the object
*/
get bytes() {
return new Uint8Array(this._ptr);
}
/**
* constructor
*/
constructor(init = {}, ptr = undefined) {
this._size = 320;
this._ptr = ptr.buffer || new ArrayBuffer(this._size);
this._data = new DataView(this._ptr);
this._encoder = new TextEncoder();
this._decoder = new TextDecoder();
for (const key of Object.keys(init)) {
this[key] = init[key];
}
}
}
export default Login