24 lines
470 B
JavaScript
24 lines
470 B
JavaScript
import msgpack from 'msgpack-lite';
|
|
|
|
export default function (Superclass) {
|
|
return class VariantPacket extends Superclass {
|
|
|
|
static pack(packet) {
|
|
packet.data[1] = msgpack.encode(packet.data[1]);
|
|
return super.pack(packet);
|
|
}
|
|
|
|
static get schema() {
|
|
return {
|
|
...super.schema,
|
|
data: 'buffer',
|
|
};
|
|
}
|
|
|
|
static unpack(packet) {
|
|
const data = super.unpack(packet);
|
|
return msgpack.decode(data);
|
|
}
|
|
|
|
}
|
|
} |