Image Manager
Download image manager plus cache manager.
Require in Node
var imageManager = ;
API
cacheAdd (image: ImageElement|{element: ImageElement}|String): Object
imageManager;// orimageManager;// orvar image = ;image;imageManager;// orvar image = ;image;imageManager;
Add image to list, put it into cache.
cacheClear ()
Clear cache from all images.
cacheGet (src: String): boolean|Object
imageManager;// → Object {element: Image, timestamp: 1430155235645}
Get information about cached image.
cacheList (): Array
imageManager;// → ["http://to.some/image_1.img", "http://to.some/image_2.img", "http://to.some/image_3.img"]
List of image url's in cache.
cacheRemove (src: String): null|Object
imageManager;// → Object {element: Image, timestamp: 1430155235645}
Remove image from cache.
configGet (): Object
imageManager;// → {// → fullRepeal: false,// → isPaused: false,// → maxDownloads: 1,// → onError: null,// → onResolve: null,// → onSuccess: null,// → }
Gets the settings for downloading images.
configReset ()
imageManager;
Resets the configuration.
configSet (configName: Object|String, configValue: *)
imageManager; // Allow cancel of image loading, applied for all new imagesimageManager; // Maximum redowloads of image, applied for all new imagesimageManager; // callback for image downloading error, applied for all new imagesimageManager; // callback for image downloading finished, applied for all new imagesimageManager; // callback for image downloading success, applied for all new images
Set configuration parameter.
imageManager.hasSource (srcUrl: String): boolean
imageManager;
Is URL in the image list.
loadImage (srcUrl: String, options: Object): boolean|Number
imageManager; imageManager;
Adds an object to the image list.
onFinish: null|Fucntion
imageManager { console;};
Callback called when everything is done.
pauseAll ()
imageManager;
Prevent all not started downloads.
pauseBySrc (srcUrl: String): Array|boolean|Object
imageManager;imageManager;
Prevent image from being downloaded.
startAll ()
imageManager;
Start all not started downloads.
startBySrc (srcUrl: String): Array|boolean
imageManager;// → true// orimageManager;// → [true, true]
Put image in download state.