Skip to main content

Interface: ISerializer

Defined in: packages/blockly/core/interfaces/i_serializer.ts:14

Serializes and deserializes a plugin or system.

Properties index​

PropertyDescription
priorityA priority value used to determine the order of deserializing state. More positive priorities are deserialized before less positive priorities. Eg if you have priorities (0, -10, 10, 100) the order of deserialiation will be (100, 10, 0, -10). If two serializers have the same priority, they are deserialized in an arbitrary order relative to each other.

Methods index​

MethodDescription
saveSaves the state of the plugin or system.
loadLoads the state of the plugin or system.
clearClears the state of the plugin or system.

Properties​

priority​

priority: number;

Defined in: packages/blockly/core/interfaces/i_serializer.ts:23

A priority value used to determine the order of deserializing state. More positive priorities are deserialized before less positive priorities. Eg if you have priorities (0, -10, 10, 100) the order of deserialiation will be (100, 10, 0, -10). If two serializers have the same priority, they are deserialized in an arbitrary order relative to each other.

Methods​

save()​

save(workspace): object | null;

Defined in: packages/blockly/core/interfaces/i_serializer.ts:32

Saves the state of the plugin or system.

Parameters​

ParameterTypeDescription
workspaceWorkspaceThe workspace the system to serialize is associated with.

Returns​

object | null

A JS object containing the system's state, or null if there is no state to record.


load()​

load(state, workspace): void;

Defined in: packages/blockly/core/interfaces/i_serializer.ts:42

Loads the state of the plugin or system.

Parameters​

ParameterTypeDescription
stateobjectThe state of the system to deserialize. This will always be non-null.
workspaceWorkspaceThe workspace the system to deserialize is associated with.

Returns​

void


clear()​

clear(workspace): void;

Defined in: packages/blockly/core/interfaces/i_serializer.ts:50

Clears the state of the plugin or system.

Parameters​

ParameterTypeDescription
workspaceWorkspaceThe workspace the system to clear the state of is associated with.

Returns​

void