Derek Bailey 82b75407a3
Wrap types in namespace for --ts-flat-files and --gen-all (#7451)
* Wrap types in namespace for --ts-flat-files and --gen-all

* Fixes for escaping object types

* Added to generate_code
2022-08-16 12:52:26 -07:00

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);
}
}