🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@armniko/assets

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@armniko/assets - npm Package Compare versions

Comparing version
1.1.0
to
1.2.0
+12
dist/core/assets-batch.d.ts
import { Progress } from './progress';
import { AssetsBatchOptions } from '../interfaces/assets-batch-options.interface';
import { BatchAsset } from '../types';
export declare class AssetsBatch {
private options;
constructor(options: AssetsBatchOptions);
assets(): BatchAsset[];
loaded(name: string, progress: Progress): void;
completed(progress: Progress): void;
error(url: string, error: Error): void;
private uniqueAssets;
}
import { AssetsBatch } from './assets-batch';
export declare class Assets {
private _store;
image(name: string): HTMLImageElement | undefined;
font(name: string): string | undefined;
fetch(batch: AssetsBatch): void;
}
import { AssetType } from '../enums/asset-type';
import { BatchAsset } from '../types';
export declare class LoadableAsset {
private readonly _batchAsset;
constructor(batchAsset: BatchAsset);
url(): string;
name(): string;
type(): AssetType | undefined;
private urlLastSegment;
}
export declare class Progress {
private readonly _total;
private readonly _loaded;
private readonly _failed;
constructor(total: number, loaded: number, failed: number);
total(): number;
loaded(): number;
failed(): number;
isCompleted(): boolean;
percents(): number;
}
import { Fetcher } from './fetcher';
export declare class ConcurrentFetcher extends Fetcher {
fetch(): void;
private onLoadAssetSuccessCallback;
private onLoadAssetErrorCallback;
private checkAndCompleteBatch;
}
import { Progress } from '../core/progress';
import { AssetRecord } from '../interfaces/asset-record.interface';
import { BatchAsset } from '../types';
export declare abstract class Fetcher {
protected _total: number;
protected _loaded: number;
protected _failed: number;
protected _batchAssets: BatchAsset[];
protected _onLoad: (assetRecord: AssetRecord, progress: Progress) => void;
protected _onComplete: (progress: Progress) => void;
protected _onError: (url: string, error: Error) => void;
constructor(batchAssets: BatchAsset[], onLoad: (assetRecord: AssetRecord, progress: Progress) => void, onComplete: (progress: Progress) => void, onError: (url: string, error: Error) => void);
abstract fetch(): void;
protected loadAsset(batchAsset: BatchAsset, onSuccess: (assetRecord: AssetRecord) => void, onError: (url: string, error: Error) => void): void;
protected progress(): Progress;
private loader;
}
import type { AssetType } from '../enums/asset-type';
import { AssetResources } from './asset-resources.interface';
export interface AssetRecord<T extends AssetType = AssetType> {
url: string;
name: string;
type: T;
asset: AssetResources[T];
}
import type { AssetType } from '../enums/asset-type';
export interface AssetResources {
[AssetType.Image]: HTMLImageElement;
[AssetType.Font]: string;
}
import { Loader } from './loader';
import { LoadableAsset } from '../core/loadable-asset';
import { AssetType } from '../enums/asset-type';
export declare class FontLoader extends Loader<AssetType.Font> {
load(loadableAsset: LoadableAsset, onSuccess: (font: string) => void, onError: (error: Error) => void): void;
}
import { Loader } from './loader';
import { LoadableAsset } from '../core/loadable-asset';
import { AssetType } from '../enums/asset-type';
export declare class ImageLoader extends Loader<AssetType.Image> {
load(loadableAsset: LoadableAsset, onSuccess: (image: HTMLImageElement) => void, onError: (error: Error) => void): void;
}
import { LoadableAsset } from '../core/loadable-asset';
import { AssetResources } from '../interfaces/asset-resources.interface';
import { AssetType } from '../enums/asset-type';
export declare abstract class Loader<T extends AssetType = AssetType> {
abstract load(loadableAsset: LoadableAsset, onSuccess: (asset: AssetResources[T]) => void, onError: (error: Error) => void): void;
}
+2
-1
export declare enum AssetType {
Image = "image"
Image = "image",
Font = "font"
}

@@ -1,3 +0,5 @@

export * from './libraries/assets';
export * from './libraries/assets-batch';
export * from './libraries/progress';
export * from './core/assets';
export * from './core/assets-batch';
export * from './core/progress';
export * from './interfaces/assets-batch-options.interface';
export type { BatchAsset } from './types';

@@ -1,1 +0,1 @@

var s,t={d:(s,e)=>{for(var o in e)t.o(e,o)&&!t.o(s,o)&&Object.defineProperty(s,o,{enumerable:!0,get:e[o]})},o:(s,t)=>Object.prototype.hasOwnProperty.call(s,t)},e={};t.d(e,{sP:()=>h,Gq:()=>d,ke:()=>a});class o{}class r extends o{load(s,t,e){const o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{t(o)},o.onerror=s=>{"string"==typeof s&&e(new Error(s))},o.src=s}}class a{_total;_loaded;_failed;constructor(s,t,e){this._total=s,this._loaded=t,this._failed=e}total(){return this._total}loaded(){return this._loaded}failed(){return this._failed}isCompleted(){return this.loaded()+this.failed()>=this.total()}percents(){return Math.floor(100/this.total()*(this.loaded()+this.failed()))}}!function(s){s.Image="image"}(s||(s={}));class i{_url;constructor(s){this._url=s}url(){return this._url}assetName(){return this.fileName().split(".")[0]}type(){let t;switch(this.fileName().split(".").pop()){case"jpg":case"jpeg":case"png":case"gif":case"svg":t=s.Image;break;default:t=void 0}return t}fileName(){return this._url.split("?")[0].split("/").filter((s=>""!==s)).pop()||""}}class l{_total=0;_loaded=0;_failed=0;_urls=[];_onLoad;_onComplete;_onError;constructor(s,t,e,o){this._urls=s,this._total=this._urls.length,this._onLoad=t,this._onComplete=e,this._onError=o}loadAsset(t,e,o){const a=new i(t);a.type()===s.Image?(new r).load(a.url(),(t=>{e({name:a.assetName(),url:a.url(),asset:t,type:s.Image})}),(s=>o(a.url(),s))):o(a.url(),new Error("Unknown asset type"))}progress(){return new a(this._total,this._loaded,this._failed)}}class n extends l{fetch(){this._urls.forEach((s=>{this.loadAsset(s,this.onLoadAssetSuccessCallback.bind(this),this.onLoadAssetErrorCallback.bind(this))}))}onLoadAssetSuccessCallback(s){this._loaded++;const t=this.progress();this._onLoad(s,t),this.checkAndCompleteBatch(t)}onLoadAssetErrorCallback(s,t){this._failed++;const e=this.progress();this._onError(s,t),this.checkAndCompleteBatch(e)}checkAndCompleteBatch(s){s.isCompleted()&&this._onComplete(s)}}class h{_store={[s.Image]:{}};image(t){return this._store[s.Image][t]?.asset}fetch(s){new n(s.assets(),((t,e)=>{this._store[t.type][t.name]=t,s.loaded(t.name,e)}),(t=>{s.completed(t)}),((t,e)=>{s.error(t,e)})).fetch()}}class d{options;constructor(s){this.options=s,s.assets=this.uniqueAssets(s.assets)}assets(){return this.options.assets}loaded(s,t){this.options.onLoad&&this.options.onLoad(s,t)}completed(s){this.options.onComplete&&this.options.onComplete(s)}error(s,t){this.options.onError&&this.options.onError(s,t)}uniqueAssets(s){return s.filter(((s,t,e)=>t===e.indexOf(s)))}}var c=e.sP,p=e.Gq,u=e.ke;export{c as Assets,p as AssetsBatch,u as Progress};
var t,s={d:(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},o:(t,s)=>Object.prototype.hasOwnProperty.call(t,s)},e={};s.d(e,{sP:()=>c,Gq:()=>d,ke:()=>r});class o{}class a extends o{load(t,s,e){const o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{s(o)},o.onerror=t=>{"string"==typeof t&&e(new Error(t))},o.src=t.url()}}class r{_total;_loaded;_failed;constructor(t,s,e){this._total=t,this._loaded=s,this._failed=e}total(){return this._total}loaded(){return this._loaded}failed(){return this._failed}isCompleted(){return this.loaded()+this.failed()>=this.total()}percents(){return Math.floor(100/this.total()*(this.loaded()+this.failed()))}}!function(t){t.Image="image",t.Font="font"}(t||(t={}));class n{_batchAsset;constructor(t){this._batchAsset=t}url(){return"string"==typeof this._batchAsset?this._batchAsset:Object.values(this._batchAsset)[0]}name(){return"string"==typeof this._batchAsset?this.urlLastSegment().split(".")[0]:Object.keys(this._batchAsset)[0]}type(){let s;switch(this.urlLastSegment().split(".").pop()){case"jpg":case"jpeg":case"png":case"gif":case"svg":s=t.Image;break;case"woff2":case"woff":case"ttf":case"otf":s=t.Font;break;default:s=void 0}return s}urlLastSegment(){return this.url().split("?")[0].split("/").filter((t=>""!==t)).pop()||""}}class i extends o{load(t,s,e){const o=new FontFace(t.name(),"url("+t.url()+")");document.fonts.add(o),o.load().then((()=>{s(t.name())})).catch((t=>{e(t)}))}}class l{_total=0;_loaded=0;_failed=0;_batchAssets=[];_onLoad;_onComplete;_onError;constructor(t,s,e,o){this._batchAssets=t,this._total=this._batchAssets.length,this._onLoad=s,this._onComplete=e,this._onError=o}loadAsset(t,s,e){const o=new n(t),a=this.loader(o);a?a.load(o,(t=>{s({name:o.name(),url:o.url(),asset:t,type:o.type()})}),(t=>e(o.url(),t))):e(o.url(),new Error("Cant find loader for `"+o.url()+"`"))}progress(){return new r(this._total,this._loaded,this._failed)}loader(s){let e;switch(s.type()){case t.Image:e=new a;break;case t.Font:e=new i}return e}}class h extends l{fetch(){this._batchAssets.forEach((t=>{this.loadAsset(t,this.onLoadAssetSuccessCallback.bind(this),this.onLoadAssetErrorCallback.bind(this))}))}onLoadAssetSuccessCallback(t){this._loaded++;const s=this.progress();this._onLoad(t,s),this.checkAndCompleteBatch(s)}onLoadAssetErrorCallback(t,s){this._failed++;const e=this.progress();this._onError(t,s),this.checkAndCompleteBatch(e)}checkAndCompleteBatch(t){t.isCompleted()&&this._onComplete(t)}}class c{_store={[t.Image]:{},[t.Font]:{}};image(s){return this._store[t.Image][s]?.asset}font(s){return this._store[t.Font][s]?.asset}fetch(t){new h(t.assets(),((s,e)=>{this._store[s.type][s.name]=s,t.loaded(s.name,e)}),(s=>{t.completed(s)}),((s,e)=>{t.error(s,e)})).fetch()}}class d{options;constructor(t){this.options=t,t.assets=this.uniqueAssets(t.assets)}assets(){return this.options.assets}loaded(t,s){this.options.onLoad&&this.options.onLoad(t,s)}completed(t){this.options.onComplete&&this.options.onComplete(t)}error(t,s){this.options.onError&&this.options.onError(t,s)}uniqueAssets(t){return t.filter(((t,s,e)=>s===e.indexOf(t)))}}var p=e.sP,u=e.Gq,_=e.ke;export{p as Assets,u as AssetsBatch,_ as Progress};

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Assets",[],e):"object"==typeof exports?exports.Assets=e():t.Assets=e()}(self,(()=>(()=>{"use strict";var t,e={d:(t,s)=>{for(var o in s)e.o(s,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:s[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},s={};e.r(s),e.d(s,{Assets:()=>d,AssetsBatch:()=>h,Progress:()=>a});class o{}class r extends o{load(t,e,s){const o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{e(o)},o.onerror=t=>{"string"==typeof t&&s(new Error(t))},o.src=t}}class a{_total;_loaded;_failed;constructor(t,e,s){this._total=t,this._loaded=e,this._failed=s}total(){return this._total}loaded(){return this._loaded}failed(){return this._failed}isCompleted(){return this.loaded()+this.failed()>=this.total()}percents(){return Math.floor(100/this.total()*(this.loaded()+this.failed()))}}!function(t){t.Image="image"}(t||(t={}));class i{_url;constructor(t){this._url=t}url(){return this._url}assetName(){return this.fileName().split(".")[0]}type(){let e;switch(this.fileName().split(".").pop()){case"jpg":case"jpeg":case"png":case"gif":case"svg":e=t.Image;break;default:e=void 0}return e}fileName(){return this._url.split("?")[0].split("/").filter((t=>""!==t)).pop()||""}}class l{_total=0;_loaded=0;_failed=0;_urls=[];_onLoad;_onComplete;_onError;constructor(t,e,s,o){this._urls=t,this._total=this._urls.length,this._onLoad=e,this._onComplete=s,this._onError=o}loadAsset(e,s,o){const a=new i(e);a.type()===t.Image?(new r).load(a.url(),(e=>{s({name:a.assetName(),url:a.url(),asset:e,type:t.Image})}),(t=>o(a.url(),t))):o(a.url(),new Error("Unknown asset type"))}progress(){return new a(this._total,this._loaded,this._failed)}}class n extends l{fetch(){this._urls.forEach((t=>{this.loadAsset(t,this.onLoadAssetSuccessCallback.bind(this),this.onLoadAssetErrorCallback.bind(this))}))}onLoadAssetSuccessCallback(t){this._loaded++;const e=this.progress();this._onLoad(t,e),this.checkAndCompleteBatch(e)}onLoadAssetErrorCallback(t,e){this._failed++;const s=this.progress();this._onError(t,e),this.checkAndCompleteBatch(s)}checkAndCompleteBatch(t){t.isCompleted()&&this._onComplete(t)}}class d{_store={[t.Image]:{}};image(e){return this._store[t.Image][e]?.asset}fetch(t){new n(t.assets(),((e,s)=>{this._store[e.type][e.name]=e,t.loaded(e.name,s)}),(e=>{t.completed(e)}),((e,s)=>{t.error(e,s)})).fetch()}}class h{options;constructor(t){this.options=t,t.assets=this.uniqueAssets(t.assets)}assets(){return this.options.assets}loaded(t,e){this.options.onLoad&&this.options.onLoad(t,e)}completed(t){this.options.onComplete&&this.options.onComplete(t)}error(t,e){this.options.onError&&this.options.onError(t,e)}uniqueAssets(t){return t.filter(((t,e,s)=>e===s.indexOf(t)))}}return s})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Assets",[],e):"object"==typeof exports?exports.Assets=e():t.Assets=e()}(self,(()=>(()=>{"use strict";var t,e={d:(t,s)=>{for(var o in s)e.o(s,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:s[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},s={};e.r(s),e.d(s,{Assets:()=>h,AssetsBatch:()=>d,Progress:()=>a});class o{}class r extends o{load(t,e,s){const o=new Image;o.crossOrigin="Anonymous",o.onload=()=>{e(o)},o.onerror=t=>{"string"==typeof t&&s(new Error(t))},o.src=t.url()}}class a{_total;_loaded;_failed;constructor(t,e,s){this._total=t,this._loaded=e,this._failed=s}total(){return this._total}loaded(){return this._loaded}failed(){return this._failed}isCompleted(){return this.loaded()+this.failed()>=this.total()}percents(){return Math.floor(100/this.total()*(this.loaded()+this.failed()))}}!function(t){t.Image="image",t.Font="font"}(t||(t={}));class n{_batchAsset;constructor(t){this._batchAsset=t}url(){return"string"==typeof this._batchAsset?this._batchAsset:Object.values(this._batchAsset)[0]}name(){return"string"==typeof this._batchAsset?this.urlLastSegment().split(".")[0]:Object.keys(this._batchAsset)[0]}type(){let e;switch(this.urlLastSegment().split(".").pop()){case"jpg":case"jpeg":case"png":case"gif":case"svg":e=t.Image;break;case"woff2":case"woff":case"ttf":case"otf":e=t.Font;break;default:e=void 0}return e}urlLastSegment(){return this.url().split("?")[0].split("/").filter((t=>""!==t)).pop()||""}}class i extends o{load(t,e,s){const o=new FontFace(t.name(),"url("+t.url()+")");document.fonts.add(o),o.load().then((()=>{e(t.name())})).catch((t=>{s(t)}))}}class l{_total=0;_loaded=0;_failed=0;_batchAssets=[];_onLoad;_onComplete;_onError;constructor(t,e,s,o){this._batchAssets=t,this._total=this._batchAssets.length,this._onLoad=e,this._onComplete=s,this._onError=o}loadAsset(t,e,s){const o=new n(t),r=this.loader(o);r?r.load(o,(t=>{e({name:o.name(),url:o.url(),asset:t,type:o.type()})}),(t=>s(o.url(),t))):s(o.url(),new Error("Cant find loader for `"+o.url()+"`"))}progress(){return new a(this._total,this._loaded,this._failed)}loader(e){let s;switch(e.type()){case t.Image:s=new r;break;case t.Font:s=new i}return s}}class c extends l{fetch(){this._batchAssets.forEach((t=>{this.loadAsset(t,this.onLoadAssetSuccessCallback.bind(this),this.onLoadAssetErrorCallback.bind(this))}))}onLoadAssetSuccessCallback(t){this._loaded++;const e=this.progress();this._onLoad(t,e),this.checkAndCompleteBatch(e)}onLoadAssetErrorCallback(t,e){this._failed++;const s=this.progress();this._onError(t,e),this.checkAndCompleteBatch(s)}checkAndCompleteBatch(t){t.isCompleted()&&this._onComplete(t)}}class h{_store={[t.Image]:{},[t.Font]:{}};image(e){return this._store[t.Image][e]?.asset}font(e){return this._store[t.Font][e]?.asset}fetch(t){new c(t.assets(),((e,s)=>{this._store[e.type][e.name]=e,t.loaded(e.name,s)}),(e=>{t.completed(e)}),((e,s)=>{t.error(e,s)})).fetch()}}class d{options;constructor(t){this.options=t,t.assets=this.uniqueAssets(t.assets)}assets(){return this.options.assets}loaded(t,e){this.options.onLoad&&this.options.onLoad(t,e)}completed(t){this.options.onComplete&&this.options.onComplete(t)}error(t,e){this.options.onError&&this.options.onError(t,e)}uniqueAssets(t){return t.filter(((t,e,s)=>e===s.indexOf(t)))}}return s})()));

@@ -1,4 +0,5 @@

import { Progress } from '../libraries/progress';
export interface AssetsBatchOptionsInterface {
assets: string[];
import type { Progress } from '../core/progress';
import { BatchAsset } from '../types';
export interface AssetsBatchOptions {
assets: BatchAsset[];
onLoad?: (name: string, progress: Progress) => void;

@@ -5,0 +6,0 @@ onComplete?: (progress: Progress) => void;

@@ -1,1 +0,3 @@

export type Asset = HTMLImageElement;
export type BatchAsset = string | {
[name: string]: string;
};
{
"name": "@armniko/assets",
"version": "1.1.0",
"version": "1.2.0",
"description": "Javascript/typescript library for fetching, storing and retrieving assets!",

@@ -34,7 +34,7 @@ "author": "Armīns Nikolajevs <armins.nikolajevs@gmail.com>",

"devDependencies": {
"@armniko/canvas": "^1.1.1",
"@armniko/ticker": "^1.0.0",
"@armniko/canvas": "^1.2.0",
"@armniko/ticker": "^2.0.0",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"eslint": "^8.57.0",

@@ -45,9 +45,9 @@ "eslint-config-prettier": "^9.1.0",

"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"prettier": "^3.3.2",
"ts-jest": "^29.1.5",
"ts-loader": "^9.5.1",
"typescript": "^5.4.3",
"webpack": "^5.91.0",
"typescript": "^5.5.3",
"webpack": "^5.92.1",
"webpack-cli": "^5.1.4"
}
}

@@ -9,3 +9,3 @@ <h1 align="center">Assets</h1>

Javascript/typescript library for fetching, storing and retrieving assets!<br>
Supported formats: jpg, jpeg, png, gif, svg
Supported formats: jpg, jpeg, png, gif, svg, woff, woff2, ttf, otf
</p>

@@ -27,4 +27,4 @@ <hr>

assets: [
'url/to/asset-1.png',
'url/to/asset-2.jpg',
'url/to/asset-1.png', // access loaded asset: assets.image('asset-1')
{asset2: 'url/to/asset-2.jpg'}, // access loaded asset: assets.image('asset2')
],

@@ -50,2 +50,9 @@ onLoad: (name: string, progress: Progress): void => {

<tr>
<td>v1.2.0</td>
<td>
Option to specify custom asset name.<br>
Added font loader.<br>
</td>
</tr>
<tr>
<td>v1.1.0</td>

@@ -52,0 +59,0 @@ <td>

import { Asset } from '../types';
import { AssetType } from '../enums/asset-type';
export interface AssetRecord {
url: string;
name: string;
type: AssetType;
asset: Asset;
}
import { AssetType } from '../enums/asset-type';
export declare class AssetUrl {
private readonly _url;
constructor(url: string);
url(): string;
assetName(): string;
type(): AssetType | undefined;
private fileName;
}
import { Progress } from './progress';
import { AssetsBatchOptionsInterface } from '../interfaces/assets-batch-options.interface';
export declare class AssetsBatch {
private options;
constructor(options: AssetsBatchOptionsInterface);
assets(): string[];
loaded(name: string, progress: Progress): void;
completed(progress: Progress): void;
error(url: string, error: Error): void;
private uniqueAssets;
}
import { AssetsBatch } from './assets-batch';
export declare class Assets {
private _store;
image(name: string): HTMLImageElement | undefined;
fetch(batch: AssetsBatch): void;
}
import { Fetcher } from './fetcher';
export declare class ConcurrentFetcher extends Fetcher {
fetch(): void;
private onLoadAssetSuccessCallback;
private onLoadAssetErrorCallback;
private checkAndCompleteBatch;
}
import { Progress } from '../progress';
import { AssetRecord } from '../../interfaces/asset-record';
export declare abstract class Fetcher {
protected _total: number;
protected _loaded: number;
protected _failed: number;
protected _urls: string[];
protected _onLoad: (assetRecord: AssetRecord, progress: Progress) => void;
protected _onComplete: (progress: Progress) => void;
protected _onError: (url: string, error: Error) => void;
constructor(urls: string[], onLoad: (assetRecord: AssetRecord, progress: Progress) => void, onComplete: (progress: Progress) => void, onError: (url: string, error: Error) => void);
abstract fetch(): void;
protected loadAsset(url: string, onSuccess: (assetRecord: AssetRecord) => void, onError: (url: string, error: Error) => void): void;
protected progress(): Progress;
}
import { Loader } from './loader';
export declare class ImageLoader extends Loader {
load(url: string, onSuccess: (image: HTMLImageElement) => void, onError: (error: Error) => void): void;
}
import { Asset } from '../../types';
export declare abstract class Loader {
abstract load(url: string, onSuccess: (asset: Asset) => void, onError: (error: Error) => void): void;
}
export declare class Progress {
private readonly _total;
private readonly _loaded;
private readonly _failed;
constructor(total: number, loaded: number, failed: number);
total(): number;
loaded(): number;
failed(): number;
isCompleted(): boolean;
percents(): number;
}