Very simple module that detects when an image is loaded and returns it via callback.
npm install --save loadim
const loadim = require('loadim');
loadim('image.jpg', (err, image) => {
if(err)
throw err;
else
document.body.appendChild(image);
});
// CrossOrigin option
loadim('image.jpg', {crossOrigin: 'anonymous'}, (err, image) => {
if(err)
throw err;
else
document.body.appendChild(image);
});
You can view the changelog here
loadim is open-sourced software licensed under the MIT license