avocado-old/packages/net/s13n/synchronized-create.packet.js
2020-06-15 17:26:20 -05:00

26 lines
524 B
JavaScript

import msgpack from 'msgpack-lite';
import SynchronizedPacket from './synchronized.packet';
export default class SynchronizedCreatePacket extends SynchronizedPacket {
static pack(packet) {
const data = packet.data[1];
data.spec = msgpack.encode(data.spec);
return super.pack(packet);
}
static get synchronizationSchema() {
return {
spec: 'buffer',
};
}
static unpack(packet) {
const data = super.unpack(packet);
data.spec = msgpack.decode(data.spec);
return data;
}
}