Class: ComponentManager
Defined in: packages/blockly/core/component_manager.ts:47
Manager for all items registered with the workspace.
Properties index
| Property | Description |
|---|---|
| Capability | - |
Methods index
| Method | Description |
|---|---|
| addComponent | Adds a component. |
| removeComponent | Removes a component. |
| addCapability | Adds a capability to a existing registered component. |
| removeCapability | Removes a capability from an existing registered component. |
| hasCapability | Returns whether the component with this id has the specified capability. |
| getComponent | Gets the component with the given ID. |
| getComponents | Gets all the components with the specified capability. |
Constructors
Constructor
new ComponentManager(): ComponentManager;
Returns
ComponentManager
Properties
Capability
static Capability: typeof Capability;
Defined in: packages/blockly/core/component_manager.ts:48
Methods
addComponent()
addComponent(componentInfo, opt_allowOverrides?): void;
Defined in: packages/blockly/core/component_manager.ts:65
Adds a component.
Parameters
| Parameter | Type | Description |
|---|---|---|
componentInfo | ComponentDatum | The data for the component to register. |
opt_allowOverrides? | boolean | True to prevent an error when overriding an already registered item. |
Returns
void
removeComponent()
removeComponent(id): void;
Defined in: packages/blockly/core/component_manager.ts:96
Removes a component.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the component to remove. |
Returns
void
addCapability()
addCapability<T>(id, capability): void;
Defined in: packages/blockly/core/component_manager.ts:114
Adds a capability to a existing registered component.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the component to add the capability to. |
capability | string | Capability<T> | The capability to add. |
Returns
void
removeCapability()
removeCapability<T>(id, capability): void;
Defined in: packages/blockly/core/component_manager.ts:141
Removes a capability from an existing registered component.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the component to remove the capability from. |
capability | string | Capability<T> | The capability to remove. |
Returns
void
hasCapability()
hasCapability<T>(id, capability): boolean;
Defined in: packages/blockly/core/component_manager.ts:173
Returns whether the component with this id has the specified capability.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the component to check. |
capability | string | Capability<T> | The capability to check for. |
Returns
boolean
Whether the component has the capability.
getComponent()
getComponent(id): IComponent | undefined;
Defined in: packages/blockly/core/component_manager.ts:187
Gets the component with the given ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the component to get. |
Returns
IComponent | undefined
The component with the given name or undefined if not found.
getComponents()
getComponents<T>(capability, sorted): T[];
Defined in: packages/blockly/core/component_manager.ts:198
Gets all the components with the specified capability.
Type Parameters
| Type Parameter |
|---|
T extends IComponent |
Parameters
| Parameter | Type | Description |
|---|---|---|
capability | string | Capability<T> | The capability of the component. |
sorted | boolean | Whether to return list ordered by weights. |
Returns
T[]
The components that match the specified capability.