2024-06-03 10:29:33 -05:00
|
|
|
class ImageLibrary {
|
2024-06-05 05:36:49 -05:00
|
|
|
private images: Record<string, Image | null> = {};
|
2024-06-03 10:29:33 -05:00
|
|
|
|
2024-06-05 05:36:49 -05:00
|
|
|
public register(hash: string, image: Image | null) {
|
2024-06-03 10:29:33 -05:00
|
|
|
this.images[hash] = image;
|
|
|
|
}
|
|
|
|
|
2024-06-05 05:36:49 -05:00
|
|
|
public get(hash: string): Image | null | undefined {
|
2024-06-03 10:29:33 -05:00
|
|
|
return this.images[hash];
|
|
|
|
}
|
|
|
|
|
2024-06-05 05:36:49 -05:00
|
|
|
public all(): Record<string, Image | null> {
|
2024-06-03 10:29:33 -05:00
|
|
|
return this.images;
|
|
|
|
}
|
|
|
|
|
2024-06-05 05:36:49 -05:00
|
|
|
public init(images: Record<string, Image | null>): void {
|
2024-06-03 10:29:33 -05:00
|
|
|
this.images = images;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const imagesLibrary = new ImageLibrary();
|