Return a Promise when one or more images, is loaded. <1KB, for the browser, no dependencies.
At your choice
npm install --save is-image-loaded-async
yarn add is-image-loaded-async
<script src="https://unpkg.com/is-image-loaded-async"></script>
is-image-loaded-async(/* Node or NodeList*/)
var isImageLoadedAsync = require("is-image-loaded-async")
// Multiple image
isImageLoadedAsync(document.querySelectorAll("img"))
.then(v => console.log(v))
.catch(e => console.log(e))
import isImageLoadedAsync from "is-image-loaded-async"
// Single image
isImageLoadedAsync(document.querySelector("img"))
.then(v => console.log(v))
.catch(e => console.log(e))
<script src="https://unpkg.com/is-image-loaded-async"></script>
<script type="text/javascript">
window.isImageLoadedAsync(document.querySelector("img"))
</script>