feat(icon): allow custom iconManager

This commit is contained in:
Jose C. Perea 2020-09-27 17:40:23 +02:00 committed by Joren Broekema
parent 84775744d8
commit 3147126295
2 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/icon': minor
---
Allow setting a custom icon manager, which is important if you as a subclasser are managing your singletons.

View file

@ -161,6 +161,11 @@ export class LionIcon extends LitElement {
}
}
// eslint-disable-next-line class-methods-use-this
get _iconManager() {
return icons;
}
/**
* @param {string} prevIconId
*/
@ -172,7 +177,7 @@ export class LionIcon extends LitElement {
}
} else {
const iconIdBeforeResolve = this.iconId;
const svg = await icons.resolveIconForId(iconIdBeforeResolve);
const svg = await this._iconManager.resolveIconForId(iconIdBeforeResolve);
// update SVG if it did not change in the meantime to avoid race conditions
if (this.iconId === iconIdBeforeResolve) {