openaire-library/utils/icons/icons.service.ts

19 lines
424 B
TypeScript

import {Injectable} from "@angular/core";
import {Icon} from "./icons";
@Injectable({
providedIn: 'root'
})
export class IconsService {
private registry = new Map<string, string>();
public registerIcons(icons: any[]): void {
icons.forEach((icon: Icon) => this.registry.set(icon.name, icon.data));
}
public getIcon(iconName: string): string | undefined {
return this.registry.get(iconName);
}
}