web-assets-manager
v2.0.1
Published
Manager for web assets.
Downloads
3
Readme
web-assets-manager
Manager for web assets.
Install
$ npm install web-assets-manager
Usage
// wam is a singletone
import wam from 'web-assets-manager';
const assets = {
logo: 'https://cdn.example.com/logo.png',
bg: 'https://cdn.example.com/bg.jpg',
// ...
};
// setup assets
wam.setup(assets);
// preload assets
wam.preload(
function onProgress(currentProgress) {
console.log(currentProgress);
},
function onComplete() {
console.log('complete');
}
);
// get assets
wam.get('logo'); // 'https://cdn.example.com/logo.png'
wam.get('bg'); // 'https://cdn.example.com/bg.jpg'
Todo
- documents about API
- strict type checking