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