Skip to content

StupidStudio/stupid-imageloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stupid Image Loader

A simple image loader

Usage

Load image:

var Imageloader = require('stupid-imageloader');
var imageloader = Imageloader();

imageloader.load('image.jpg') // returns a promise (stupid-deferred)
.success(function(image){
	// Do something
})
.error(function(){
	// Do something
});

Chain loading events:

imageloader.load('image.jpg') // returns a promise (stupid-deferred)
.then(function(){
	// On success
	return imageloader.load('new-image.jpg');
}, function(){
	// On error
})
.then(function(){
	return imageloader.load('another-new-image.jpg');
})
.then(function(){
	// All 3 images is loaded after each other
});