ConvertArray

ceramic.ConvertArray (Class)
Implements: ConvertField

Converter for array fields in fragments and data serialization.

This converter handles array types by creating deep copies to ensure data integrity between the original and converted values. Used by the fragment system to convert between serialized array data and runtime array instances.

Instance Members

basicToField(instance: Entity, field: String, assets: Assets, basic: Array<ceramic.ConvertArray.T>, done: Function): Void

Convert a basic array to a field array by creating a deep copy.

This method ensures that the field instance has its own array that won't be affected by changes to the original basic array.

Name Type Description
instance Entity The entity that owns this field
field String The name of the field being converted
assets Assets Assets instance for resource loading (unused for arrays)
basic Array<ceramic.ConvertArray.T> The source array to convert
done Function Callback invoked with the converted array copy

fieldToBasic(instance: Entity, field: String, value: Array<ceramic.ConvertArray.T>): Array<ceramic.ConvertArray.T>

Convert a field array to a basic array by creating a deep copy.

This method ensures that the serialized data has its own array that won't be affected by changes to the field array.

Name Type Description
instance Entity The entity that owns this field
field String The name of the field being converted
value Array<ceramic.ConvertArray.T> The field array to convert
Returns Description
Array<ceramic.ConvertArray.T> A new array containing copies of all elements

new(): Void

Create a new array converter instance.