See the 2022 Blockly Developer Summit site here.

Class: BlockSerializer

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

Blockly.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

Blockly.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

Blockly.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.