Class: ComponentManager

Constructor

ComponentManager

new ComponentManager()

Manager for all items registered with the workspace.

Class

Methods

addCapability

addCapability(id, capability)

Adds a capability to a existing registered component.

Parameter

id

string

The ID of the component to add the capability to.

capability

(string or non-null Blockly.ComponentManager.Capability containing T)

The capability to add.

addComponent

addComponent(componentInfo, opt_allowOverrides)

Adds a component.

Parameter

componentInfo

Blockly.ComponentManager.ComponentDatum

The data for the component to register.

Value must not be null.

opt_allowOverrides

Optional

boolean

True to prevent an error when overriding an already registered item.

getComponent

getComponent(id) returns (Blockly.IComponent or undefined)

Gets the component with the given ID.

Parameter

id

string

The ID of the component to get.

Returns

(non-null Blockly.IComponent or undefined) The component with the given name or undefined if not found.

getComponents

getComponents(capability, sorted) returns Array of T

Gets all the components with the specified capability.

Parameter

capability

(string or non-null Blockly.ComponentManager.Capability containing T)

The capability of the component.

sorted

boolean

Whether to return list ordered by weights.

Returns

non-null Array of T The components that match the specified capability.

hasCapability

hasCapability(id, capability) returns boolean

Returns whether the component with this id has the specified capability.

Parameter

id

string

The ID of the component to check.

capability

(string or non-null Blockly.ComponentManager.Capability containing T)

The capability to check for.

Returns

boolean Whether the component has the capability.

removeCapability

removeCapability(id, capability)

Removes a capability from an existing registered component.

Parameter

id

string

The ID of the component to remove the capability from.

capability

(string or non-null Blockly.ComponentManager.Capability containing T)

The capability to remove.

removeComponent

removeComponent(id)

Removes a component.

Parameter

id

string

The ID of the component to remove.

Abstract type

ComponentDatum

static

{component: non-null Blockly.IComponent, capabilities: non-null Array of (string or non-null Blockly.ComponentManager.Capability containing non-null Blockly.IComponent), weight: number}

An object storing component information.