New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

image-preloader-promise

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-preloader-promise

Preload an image and provide information about the success / failure of the operation.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

image-preloader-promise

Preload an image or a collection of images and return a promise (ES6)

installation

node:

npm install image-preloader-promise

usage

preload a single image

ImagePreloader.preloadImage(imageSrc)
	.then(() => {
		console.log('Image loaded!');		
	})
	.catch((error) => {
		console.log('The image was not able to be loaded!');
	});

preload multiple images

let imagePath = ['https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png', 'http://somesite/someimage.gif'];
ImagePreloader.preloadImages(imagePath)
	.then(function (data) {
		console.log('At least one image was loaded!');
		for (var x = 0; x < data.length; x++) {
			console.log(`image ${x} was ${data[x].state}`);
		}
	})
	.catch(function (err) {
		console.log('None of the images were able to be loaded!');
	});

Keywords

javascript

FAQs

Package last updated on 14 Apr 2016

Did you know?

Socket

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.

Install

Related posts