MCPcopy
hub / github.com/RaspberryPiFoundation/blockly / removeIcon

Method removeIcon

packages/blockly/core/block.ts:2424–2429  ·  view source on GitHub ↗

* Removes the icon whose getType matches the given type iconType from the * block. * * @param type The type of the icon to remove from the block. * @returns True if an icon with the given type was found, false otherwise.

(type: IconType<IIcon>)

Source from the content-addressed store, hash-verified

2422 * @returns True if an icon with the given type was found, false otherwise.
2423 */
2424 removeIcon(type: IconType<IIcon>): boolean {
2425 if (!this.hasIcon(type)) return false;
2426 this.getIcon(type)?.dispose();
2427 this.icons = this.icons.filter((icon) => !icon.getType().equals(type));
2428 return true;
2429 }
2430
2431 /**
2432 * @returns True if an icon with the given type exists on the block,

Callers 2

setCommentTextMethod · 0.95
block_test.jsFile · 0.45

Calls 5

hasIconMethod · 0.95
getIconMethod · 0.95
disposeMethod · 0.65
getTypeMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected