0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/ui-src/parser/libraries/UiImages.ts
Jordi Sala Morales 3094f05e98
Optimize images before generating zip file (#141)
* Optimize images before generating zip file

* add changelog

* refactor

* fix lint
2024-06-05 12:36:49 +02:00

23 lines
462 B
TypeScript

import { ImageColor } from '@ui/lib/types/utils/imageColor';
class UiImages {
private images: Record<string, ImageColor> = {};
public register(id: string, image: ImageColor) {
this.images[id] = image;
}
public get(id: string): ImageColor | undefined {
return this.images[id];
}
public all(): ImageColor[] {
return Object.values(this.images);
}
public init() {
this.images = {};
}
}
export const uiImages = new UiImages();