API

Define APIs.

Source:

Methods

(inner) addBlock(blockInfo)

Source:

Add a block from prototype.

Parameters:
Name Type Description
blockInfo BlockPrototype

Block prototype.

(inner) addCategory(categoryInfo)

Source:

Add a category from prototype.

Parameters:
Name Type Description
categoryInfo CategoryPrototype

Category prototype.

(inner) getBlockInstance() → {ClipCCBlock}

Source:

Get clipcc-block instance.

Returns:
Type
ClipCCBlock

(inner) getGuiInstance() → {ClipCCGUI}

Source:

Get clipcc-gui instance.

Returns:
Type
ClipCCGUI

(inner) getPlaygroundData()

Source:

Get data for playground.

(inner) getVmInstance() → {ClipCCVM}

Source:

Get clipcc-vm instance.

Returns:
Type
ClipCCVM

(inner) isDesktop() → {boolean}

Source:

Return whether the editor is in the desktop environment.

Returns:
Type
boolean

(inner) isEditorLoading() → {boolean}

Source:

Return whether the editor is loading.

Returns:
Type
boolean

(inner) loadProject(input, extensionCallback) → {Promise}

Source:

Load a Scratch project from a .sb, .sb2, .sb3 or json string.

Parameters:
Name Type Description
input string | object

A json string, object, or ArrayBuffer representing the project to load.

extensionCallback function

A function to deal with extension list.

Returns:

Promise that resolves after targets are installed.

Type
Promise

(inner) registExtensionAPI(api)

Source:

Register an API. [Dangerous] You should not call this function in your extension.

Parameters:
Name Type Description
api object

API object.

(inner) removeBlock(blockOpcode)

Source:

Remove a block by opcode.

Parameters:
Name Type Description
blockOpcode string

Block opcode.

(inner) removeCategory(categoryId)

Source:

Remove a category by id.

Parameters:
Name Type Description
categoryId string

Category id.