Sets a new SVG icon with a particular name.
(rawName: string | undefined)
| 449 | |
| 450 | /** Sets a new SVG icon with a particular name. */ |
| 451 | private _updateSvgIcon(rawName: string | undefined) { |
| 452 | this._svgNamespace = null; |
| 453 | this._svgName = null; |
| 454 | this._currentIconFetch.unsubscribe(); |
| 455 | |
| 456 | if (rawName) { |
| 457 | const [namespace, iconName] = this._splitIconName(rawName); |
| 458 | |
| 459 | if (namespace) { |
| 460 | this._svgNamespace = namespace; |
| 461 | } |
| 462 | |
| 463 | if (iconName) { |
| 464 | this._svgName = iconName; |
| 465 | } |
| 466 | |
| 467 | this._currentIconFetch = this._iconRegistry |
| 468 | .getNamedSvgIcon(iconName, namespace) |
| 469 | .pipe(take(1)) |
| 470 | .subscribe( |
| 471 | svg => this._setSvgElement(svg), |
| 472 | (err: Error) => { |
| 473 | const errorMessage = `Error retrieving icon ${namespace}:${iconName}! ${err.message}`; |
| 474 | this._errorHandler.handleError(new Error(errorMessage)); |
| 475 | }, |
| 476 | ); |
| 477 | } |
| 478 | } |
| 479 | } |
no test coverage detected