-
Notifications
You must be signed in to change notification settings - Fork 16
Serialization
frcroth edited this page May 11, 2021
·
2 revisions
- Morphs in the world get serialized, by serializing their properties
- To save custom morph properties, they need to be defined in the
properties
getter. More info
- Saving creates a snapshot
- The serializer dissolves circular dependencies
- When serializing was successful, lively tries to deserialize the snapshot
- Only if this works saving was successful
- one can use methods like
__after_deserialize__
and similar as hooks (_additionaly_serialize__
) - Use
addFn('propertyName' , propertyValue)
to add additional properties, this will dissolve circular dependencies - just adding
snapshot.prop.propname = propValue
will work but not check whether there are circular dependencies
Some properties can not be saved
- WeakMaps, WeakRefs
- use the hooks to make custom data structures to save them