@armniko/assets
v1.2.0
Published
Javascript/typescript library for fetching, storing and retrieving assets!
Downloads
2
Maintainers
Readme
Installation
npm install @armniko/assets
Usage
import {Assets, AssetsBatch, Progress} from '@armniko/assets';
const assetsBatch: AssetsBatch = new AssetsBatch({
assets: [
'url/to/asset-1.png', // access loaded asset: assets.image('asset-1')
{asset2: 'url/to/asset-2.jpg'}, // access loaded asset: assets.image('asset2')
],
onLoad: (name: string, progress: Progress): void => {
console.log('Loaded: ' + name, progress.percents());
},
onComplete: (): void => {
console.log('Done!');
},
onError: (url: string, error: Error): void => {
console.log(url, error);
}
});
const assets: Assets = new Assets();
assets.fetch(assetsBatch);