Manager for web assets.
$ npm install web-assets-manager
// 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'
- documents about API
- strict type checking