Files
Zos/Skills/@be/node_modules/jibo-loader/lib/dts/AssetManager.d.ts

99 lines
3.8 KiB
TypeScript

import AssetLoad from './AssetLoad';
import { Asset, ITaskDefinition } from './AssetLoad';
import Callback from './LoaderCallback';
export interface LoadOptions {
complete?: Function;
progress?: Function;
taskDone?: Function;
cacheAll?: string;
maxLoads?: number;
autoStart?: boolean;
}
export declare function getCacheKeyFromAsset(asset: Asset, manager: AssetManager): string;
/**
* Gets the progress of the load.
* @callback jibo.loader.AssetManager~progressCallback
* @param {Number} progress The amount of tasks loaded from 0 to 1.
*/
/**
* Executes when a load is complete.
* @callback jibo.loader.AssetManager~completeCallback
* @param {Error} error The error, if any, thrown by loading.
* @param {*} result The result of load.
*/
/**
* Handles the asynchronous loading of multiple assets.
* @class AssetManager
* @memberof jibo.loader
* @intdocs
*/
export default class AssetManager {
/**
* The collection of task definitions.
* @type {array}
* @name jibo.loader.AssetManager#taskDefs
* @readOnly
*/
taskDefs: Array<ITaskDefinition>;
/**
* The maximum number of loads to do at once.
* @type {Number}
* @name jibo.loader.AssetManager#maxDefaultLoads
* @default 4
*/
maxDefaultLoads: number;
constructor();
/**
* Loads a bunch of assets. Can only call one load at a time.
* @method jibo.loader.AssetManager#load
* @param {Object|Array} asset The assets to load.
* @param {Object} [options] The loading options.
* @param {jibo.loader.AssetManager~completeCallback} [options.complete] The callback when finished.
* @param {jibo.loader.AssetManager~progressCallback} [options.progress] The callback when loading percentage is updated.
* @param {jibo.loader.Task~completeCallback} [options.taskDone] The callback when finished with each individual task.
* @param {Boolean} [options.autoStart=true] `true` to start running right away.
* @param {Number} [options.maxLoads=4] The maximum number of simultaneous loads, 0 for all.
* @param {Boolean} [options.remoteAll=false] `true` to force remote calls on all assets.
* @param {Number} [options.timeoutAll=false] Number of milliseconds to timeout remote calls.
* @param {Boolean|String} [options.cacheAll=false] `true` to cache all files. String as the cache id.
* @return {jibo.loader.AssetLoad} The reference to the current load.
*/
load(assets: {
[id: string]: Asset;
} | Array<Asset>, options?: LoadOptions): AssetLoad;
/**
* Loads the asset file.
* @method jibo.loader.AssetManager#simpleLoad
* @param {String} uri The file to load.
* @param {Function} callback Callback when complete.
* @param {Object} [options]
* @param {Number} [options.timeout] Number of milliseconds to timeout remote load.
* @param {Boolean} [options.remote] `true` to force remote loading, `false` to auto-detect.
*/
simpleLoad(uri: string, callback: Callback, options?: any): void;
/**
* Prepare the URI to be absolute.
* @method jibo.loader.AssetManager#prepare
* @param {String} uri The file to load.
* @param {Boolean} [remote=false] `true` to force remote loading, `false` to auto-detect.
* @return {String} The absolute URL or URI to request.
*/
prepare(uri: string, remote?: boolean): string;
/**
* Cancel all current loads.
* @method jibo.loader.AssetManager#cancelAll
*/
cancelAll(): void;
/**
* Destroys the AssetManager.
* @method jibo.loader.AssetManager#destroy
*/
destroy(): void;
/**
* Stashes the load for use later.
* @method jibo.loader.AssetManager#cancel
* @param {jibo.loader.AssetLoad} load The load to recycle.
*/
cancel(load: AssetLoad): void;
}