Blockly.serialization.blocks. BlockSerializer
Serializer for saving and loading block state.
Constructor
BlockSerializer
new BlockSerializer()
- Implements
- Blockly.serialization.ISerializer
Property
priority
number
The priority for deserializing blocks.
Methods
clear
clear(workspace)
Disposes of any blocks that exist on the workspace.
Parameter |
|
---|---|
workspace |
The workspace to clear the blocks of. Value must not be null. |
load
load(state, workspace)
Deserializes the blocks defined by the given state into the given workspace.
Parameter |
|
---|---|
state |
{languageVersion: number, blocks: non-null Array of non-null State} The state of the blocks to deserialize. |
workspace |
The workspace to deserialize into. Value must not be null. |
save
save(workspace) returns Object
Serializes the blocks of the given workspace.
Parameter |
|
---|---|
workspace |
The workspace to save the blocks of. Value must not be null. |
- Returns
-
nullable {languageVersion: number, blocks: non-null Array of non-null State}
The state of the workspace's blocks, or null if there are no blocks.