@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
30 lines (23 loc) • 725 B
JavaScript
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
import PropertySet from "./PropertySet.js";
export class PropertySetSerializationAdapter extends BinaryClassSerializationAdapter {
klass = PropertySet;
version = 0;
/**
*
* @param {BinaryBuffer} buffer
* @param {PropertySet} value
*/
serialize(buffer, value) {
buffer.writeUTF8String(JSON.stringify(value.data));
}
/**
*
* @param {BinaryBuffer} buffer
* @param {PropertySet} value
*/
deserialize(buffer, value) {
const string = buffer.readUTF8String();
value.data = JSON.parse(string);
}
}