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

Method getIcon

packages/blockly/core/block.ts:2445–2451  ·  view source on GitHub ↗

* @param type The type of the icon to retrieve. Prefer passing an `IconType` * for proper type checking when using typescript. * @returns The icon with the given type if it exists on the block, undefined * otherwise.

(type: IconType<T> | string)

Source from the content-addressed store, hash-verified

2443 * otherwise.
2444 */
2445 getIcon<T extends IIcon>(type: IconType<T> | string): T | undefined {
2446 if (type instanceof IconType) {
2447 return this.icons.find((icon) => icon.getType().equals(type)) as T;
2448 } else {
2449 return this.icons.find((icon) => icon.getType().toString() === type) as T;
2450 }
2451 }
2452
2453 /** @returns An array of the icons attached to this block. */
2454 getIcons(): IIcon[] {

Callers 15

getCommentTextMethod · 0.95
setCommentTextMethod · 0.95
removeIconMethod · 0.95
childHasWarningMethod · 0.80
setWarningTextMethod · 0.80
blockToDomFunction · 0.80
applyCommentTagNodesFunction · 0.80
mutatorOpenListenerFunction · 0.80
loadIconsFunction · 0.80
runMethod · 0.80
procedures.tsFile · 0.80

Calls 3

getTypeMethod · 0.65
equalsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected