Class: RecyclableBlockFlyoutInflater
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:12
A block inflater that caches and reuses blocks to improve performance.
Extends
BlockFlyoutInflater
Properties index
| Property | Description |
|---|---|
| flyout | - |
| listeners | - |
| permanentlyDisabledBlocks | - |
| recycleEligibilityChecker | Custom function to use for checking whether or not blocks can be recycled. |
| recyclingEnabled | Whether or not block recycling is enabled. |
Methods index
| Method | Description |
|---|---|
| addBlockListeners | Add listeners to a block that has been added to the flyout. |
| blockIsRecyclable | Returns whether the given block can be recycled or not. |
| createBlock | Creates a new block from the given block definition. |
| disposeItem | Disposes of the provided block. |
| emptyRecycledBlocks | Clears the cache of recycled blocks. |
| gapForItem | Returns the amount of space that should follow this block. |
| getType | Returns the type of items this inflater is responsible for creating. |
| load | Inflates a flyout block from the given state and adds it to the flyout. |
| removeListeners | Removes event listeners for the block with the given ID. |
| setFlyout | Updates this inflater's flyout. |
Constructors
Constructor
new RecyclableBlockFlyoutInflater(): RecyclableBlockFlyoutInflater;
Creates a new BlockFlyoutInflater instance.
Returns
RecyclableBlockFlyoutInflater
Inherited from
Blockly.BlockFlyoutInflater.constructor
Properties
flyout?
protected flyout?: IFlyout;
Inherited from
Blockly.BlockFlyoutInflater.flyout
listeners
protected listeners: Map<string, Data[]>;
Inherited from
Blockly.BlockFlyoutInflater.listeners
permanentlyDisabledBlocks
protected permanentlyDisabledBlocks: Set<BlockSvg>;
Inherited from
Blockly.BlockFlyoutInflater.permanentlyDisabledBlocks
recycleEligibilityChecker?
recycleEligibilityChecker?: (block) => boolean;
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:26
Custom function to use for checking whether or not blocks can be recycled.
Parameters
| Parameter | Type |
|---|---|
block | Block |
Returns
boolean
recyclingEnabled
recyclingEnabled: boolean = false;
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:16
Whether or not block recycling is enabled.
Methods
addBlockListeners()
protected addBlockListeners(block): void;
Add listeners to a block that has been added to the flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | BlockSvg | The block to add listeners for. |
Returns
void
Inherited from
Blockly.BlockFlyoutInflater.addBlockListeners
blockIsRecyclable()
protected blockIsRecyclable(block): boolean;
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:108
Returns whether the given block can be recycled or not.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | Block | The block to check for recyclability. |
Returns
boolean
True if the block can be recycled. False otherwise.
createBlock()
createBlock(blockDefinition, workspace): BlockSvg;
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:35
Creates a new block from the given block definition.
Parameters
| Parameter | Type | Description |
|---|---|---|
blockDefinition | BlockInfo | The definition to create a block from. |
workspace | WorkspaceSvg | The workspace to create the block on. |
Returns
BlockSvg
The newly created block.
Overrides
Blockly.BlockFlyoutInflater.createBlock
disposeItem()
disposeItem(item): void;
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:152
Disposes of the provided block.
Parameters
| Parameter | Type | Description |
|---|---|---|
item | FlyoutItem | The block to dispose of. |
Returns
void
Overrides
Blockly.BlockFlyoutInflater.disposeItem
emptyRecycledBlocks()
emptyRecycledBlocks(): void;
Defined in: plugins/continuous-toolbox/src/RecyclableBlockFlyoutInflater.ts:168
Clears the cache of recycled blocks.
Returns
void
gapForItem()
gapForItem(state, defaultGap): number;
Returns the amount of space that should follow this block.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | object | A JSON representation of a flyout block. |
defaultGap | number | The default spacing for flyout items. |
Returns
number
The amount of space that should follow this block.
Inherited from
Blockly.BlockFlyoutInflater.gapForItem
getType()
getType(): string;
Returns the type of items this inflater is responsible for creating.
Returns
string
An identifier for the type of items this inflater creates.
Inherited from
Blockly.BlockFlyoutInflater.getType
load()
load(state, flyout): FlyoutItem;
Inflates a flyout block from the given state and adds it to the flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | object | A JSON representation of a flyout block. |
flyout | IFlyout | The flyout to create the block on. |
Returns
FlyoutItem
A newly created block.
Inherited from
Blockly.BlockFlyoutInflater.load
removeListeners()
protected removeListeners(blockId): void;
Removes event listeners for the block with the given ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
blockId | string | The ID of the block to remove event listeners from. |
Returns
void
Inherited from
Blockly.BlockFlyoutInflater.removeListeners
setFlyout()
protected setFlyout(flyout): void;
Updates this inflater's flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
flyout | IFlyout | The flyout that owns this inflater. |
Returns
void
Inherited from
Blockly.BlockFlyoutInflater.setFlyout