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/plugin-src/ImageLibrary.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

21 lines
474 B
TypeScript

class ImageLibrary {
private images: Record<string, Image | null> = {};
public register(hash: string, image: Image | null) {
this.images[hash] = image;
}
public get(hash: string): Image | null | undefined {
return this.images[hash];
}
public all(): Record<string, Image | null> {
return this.images;
}
public init(images: Record<string, Image | null>): void {
this.images = images;
}
}
export const imagesLibrary = new ImageLibrary();