Skip to main content

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​

PropertyDescription
flyout-
listeners-
permanentlyDisabledBlocks-
recycleEligibilityCheckerCustom function to use for checking whether or not blocks can be recycled.
recyclingEnabledWhether or not block recycling is enabled.

Methods index​

MethodDescription
addBlockListenersAdd listeners to a block that has been added to the flyout.
blockIsRecyclableReturns whether the given block can be recycled or not.
createBlockCreates a new block from the given block definition.
disposeItemDisposes of the provided block.
emptyRecycledBlocksClears the cache of recycled blocks.
gapForItemReturns the amount of space that should follow this block.
getTypeReturns the type of items this inflater is responsible for creating.
loadInflates a flyout block from the given state and adds it to the flyout.
removeListenersRemoves event listeners for the block with the given ID.
setFlyoutUpdates 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​

ParameterType
blockBlock

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​

ParameterTypeDescription
blockBlockSvgThe 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​

ParameterTypeDescription
blockBlockThe 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​

ParameterTypeDescription
blockDefinitionBlockInfoThe definition to create a block from.
workspaceWorkspaceSvgThe 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​

ParameterTypeDescription
itemFlyoutItemThe 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​

ParameterTypeDescription
stateobjectA JSON representation of a flyout block.
defaultGapnumberThe 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​

ParameterTypeDescription
stateobjectA JSON representation of a flyout block.
flyoutIFlyoutThe 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​

ParameterTypeDescription
blockIdstringThe 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​

ParameterTypeDescription
flyoutIFlyoutThe flyout that owns this inflater.

Returns​

void

Inherited from​

Blockly.BlockFlyoutInflater.setFlyout