A prototype for an image with a progress bar that show the progress of download of the image.
First create an HeavyImage instance with the target URL and then place the internal
element somewhere on the page using theImage.$element and when ready stard downloading
the image with theImage.load().
const images = Array(3).fill(0).map(() => {
return new HeavyImage("https://upload.wikimedia.org/wikipedia/commons/3/3d/LARGE_elevation.jpg");
});
images.forEach(img => {
document.body.appendChild(img.$element);
img.$element.style.margin = '1rem';
img.$element.style.width = '200px';
img.$element.style.height = '200px';
img.$element.onclick = function() {
img.load();
}
});
images.forEach(img => {
img.load();
});