Preloading Images and Detecting When All Are Loaded

Quick start with the Image constructor, promises, and more

Photo by the author, Cinque Terre

In this article, I will aim to create a function retrieving an image from a given URL and detecting when this image is loaded. Instead of taking a callback then runs when the image has fully loaded the new function returns a promise. The then and catch method can be used on the…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store