
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
pyrsmk-imagine
Advanced tools
This library is now obsolete and I encourage you to choose another solution like imagesLoaded
Imagine is a tiny image (pre)loading library with promises. It fixes weird behaviors on some browsers and add a simple/stable way to know if one or several images are loaded or not.
You can pick the minified library or install it with :
npm install pyrsmk-imagine
bower install pyrsmk-imagine
Imagine lets you load one or several images and executes some tasks when they had fully loaded, or catch errors when something went wrong. Here's an example with already existing images :
imagine($('img')).then(function(images) {
// the 'images' variable refers to the loaded images
$(images).animate({
opacity: 1,
duration: 250
});
})
.catch(function(images) {
// 'images' refers to the failed images
$(images).css('background','red');
});
You can also preload some images for future use by specifying their URLs.
var images = [
'images/example.jpg',
'http://example.com/images/cat.png'
],
preloaded;
// Preload images
imagine(images).then(function(images) {
preloaded = images;
});
/*
...
*/
// Finally add them to the body
$(preloaded).forEach(function() {
$('body').append(this);
});
Published under the MIT license.
FAQs
A fast image loader with promises
We found that pyrsmk-imagine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.