Serialization
Preview version
The jsMind V2 programming API is currently a preview. The API will change in later updates. Please check this documentation anytime for the interface that is current.
Read and write a mind map through jsMind.Serializer.create(format). JsMind.serialize() is a JSON convenience on an open map.
This page is generated from the published typings dist/jsmind.d.ts with TypeDoc.
JmMindSerializerFactory
Class
Creates serializers for the formats the library can read and write.
Constructor
constructor()create
static create(format: string): JmMindSerializerCreates a serializer for the given format.
Returns: A serializer for that format.
Throws
JsMindErrorIf the format is not supported.
Parameters
| Name | Type | Description |
|---|---|---|
format | string | 'json' or 'freemind'. |
JmMindSerializer
Interface
Base interface for all mind map serializers.
deserialize
deserialize(data: unknown): JmMindDeserializes data to a mind map.
Returns: The deserialized mind map.
Throws
JsMindErrorIf deserialization fails.
Parameters
| Name | Type | Description |
|---|---|---|
data | unknown | The data to deserialize. |
getFormatName
getFormatName(): stringGets the format name this serializer supports.
Returns: The format name.
Throws
JsMindErrorIf format name is not implemented.
serialize
serialize(mind: JmMind): unknownSerializes a mind map to the specific format.
Returns: The serialized data in the specific format.
Throws
JsMindErrorIf serialization fails.
Parameters
| Name | Type | Description |
|---|---|---|
mind | JmMind | The mind map to serialize. |
validate
validate(data: unknown): booleanValidates if the data can be deserialized by this serializer.
Returns: True if the data is valid for this format.
Throws
JsMindErrorIf validation fails.
Parameters
| Name | Type | Description |
|---|---|---|
data | unknown | The data to validate. |