You defined the whole structure for serialization in the constructor by defining all property name to serializer mapping via the initialSerializer argument. See the README for an example.
The serializerOptions is used to define the instance creator, which should be used to create new object instances of this type. This can be useful if you want to create a instance of a class of attach a prototype manually.
In any case, any member will be overwritten by the defined serializers or the static members. The default is just
the object literal {}
.
Appends a serializer for the given name. This serializer needs to be able to serialize the type of the field from the object. There is no check whether the field actually exists or if there is already another serializer registered for this field identifier.
All serializer will be called in their appended order.
The field name to attach this serializer on.
The serializer to attach on that field.
This method sets a static value which will not be serialized and transferred but added after the serialization is finished. This can be useful when you have an identifier member which is always the same for all instanced of this type.
The name of the field for the static value.
The value which should be put there.
Shortcut which deserializes the value and assumes the whole ArrayBuffer for this action.
the ArrayBuffer which contains the value
Clones this object serializer, which can be handy if you want to create the serializers for two different subtypes of a more general instance.
A clone of this object serializer
Removes the serializer which are appended using this field identifier.
the name to search for
Shortcut which creates an appropriately sized ArrayBuffer for the value and serializes the value.
the value to serialize
Generated using TypeDoc
The ObjectSerializer is meant to give you a an easy to use way to map an simple object structure to a binary representation by iteratively serializing / deserializing the properties of the object.