class Resources {
	private images = new Map<string, HTMLImageElement>();

	loadImage(name: string, path: string) {
		return new Promise((resolve) => {
			const image = new Image();
			image.src = path;
			image.onload = () => {
				this.images.set(name, image);
				resolve(image);
			};
		});
	}

	getImage(name: string): HTMLImageElement {
		return this.images.get(name)!;
	}
}

const resources = new Resources();

export default resources;
