let i = 1;
function loadImage () {
let img = new Image();
img.onload = () => {
if (i === count) {
resolve();
} else {
i++;
loadImage();
}
};
img.src = path;
}
loadImage();