mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 05:47:36 +00:00
* Move TS tests to dedicated folder and deps upgrade * Attempt to fix generate_code * Fix dir on CI * Add js extension * Fix missing extension * Harmonize with test gen * Unexplained code gen change * Restore yarn.lock * Naive attempt to fix bazel stuff * Pin @bazel/typescript to 5.2.0 * Attempt to fix bazel * More tweak * Upgrade deps * Tweak? * Fix path * Fix test package Co-authored-by: Derek Bailey <derekbailey@google.com>
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
// automatically generated by the FlatBuffers compiler, do not modify
|
|
import * as flatbuffers from 'flatbuffers';
|
|
export class Monster {
|
|
constructor() {
|
|
this.bb = null;
|
|
this.bb_pos = 0;
|
|
}
|
|
__init(i, bb) {
|
|
this.bb_pos = i;
|
|
this.bb = bb;
|
|
return this;
|
|
}
|
|
static getRootAsMonster(bb, obj) {
|
|
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
}
|
|
static getSizePrefixedRootAsMonster(bb, obj) {
|
|
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
|
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
|
}
|
|
static getFullyQualifiedName() {
|
|
return 'MyGame_Example2_Monster';
|
|
}
|
|
static startMonster(builder) {
|
|
builder.startObject(0);
|
|
}
|
|
static endMonster(builder) {
|
|
const offset = builder.endObject();
|
|
return offset;
|
|
}
|
|
static createMonster(builder) {
|
|
Monster.startMonster(builder);
|
|
return Monster.endMonster(builder);
|
|
}
|
|
serialize() {
|
|
return this.bb.bytes();
|
|
}
|
|
static deserialize(buffer) {
|
|
return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer));
|
|
}
|
|
unpack() {
|
|
return new MonsterT();
|
|
}
|
|
unpackTo(_o) { }
|
|
}
|
|
export class MonsterT {
|
|
constructor() { }
|
|
pack(builder) {
|
|
return Monster.createMonster(builder);
|
|
}
|
|
}
|