* @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)
| 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[] { |
no test coverage detected