mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
f726dc9cec
* Add image library to optimize performance * fix and improve * Add changelog and improve naming * refactor * improve * fix todos
23 lines
526 B
TypeScript
23 lines
526 B
TypeScript
import { ImageColor } from '@ui/lib/types/utils/imageColor';
|
|
|
|
class ImageLibrary {
|
|
private images: Record<string, ImageColor> = {};
|
|
|
|
public register(hash: string, image: ImageColor) {
|
|
this.images[hash] = image;
|
|
}
|
|
|
|
public get(hash: string): ImageColor | undefined {
|
|
return this.images[hash];
|
|
}
|
|
|
|
public all(): Record<string, ImageColor> {
|
|
return this.images;
|
|
}
|
|
|
|
public init(images: Record<string, ImageColor>): void {
|
|
this.images = images;
|
|
}
|
|
}
|
|
|
|
export const imagesLibrary = new ImageLibrary();
|