Warning AssetManager JS is no more maintained. It is advised to use modern technologies, see Preloading responsive images
AssetManager JS is a robust and lightweight JavaScript asset manager for images. For example it can be used to quickly preload a set of images for your HTML5 project.
bower install assetmanager-js
- Include AssetManager.min.js in your website or application from the bower installation folder
- Download a 1KB Assetmanager.min.js
- Include it in your website or application
Initialize:
var assetManager = new AssetManager();
Queue assets:
assetManager.add('firstAssetId', 'path/to/asset1.file');
assetManager.add('secondAssetId', 'path/to/asset2.file');
Download all assets:
// callbackFunction will be called once all assets have been downloaded
assetManager.downloadAll(callbackFunction);
Retrieve asset:
var firstAssetObject = assetManager.get('firstAssetId');
See example/index.html.