140 lines
4.6 KiB
JavaScript
140 lines
4.6 KiB
JavaScript
/**
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* The collection of current multiloads.
|
|
* @type {array<jibo.loader.AssetLoad>}
|
|
* @name jibo.loader.AssetManager#loads
|
|
* @private
|
|
* @readOnly
|
|
*/
|
|
|
|
/**
|
|
* The expired loads to reuse.
|
|
* @type {array<jibo.loader.AssetLoad>}
|
|
* @name jibo.loader.AssetManager#loadPool
|
|
* @private
|
|
* @readOnly
|
|
*/
|
|
|
|
/**
|
|
* The collection of task definitions.
|
|
* @type {array}
|
|
* @name jibo.loader.AssetManager#taskDefs
|
|
* @readOnly
|
|
*/
|
|
|
|
/**
|
|
* The cache of assets.
|
|
* @type {jibo.loader.AssetCache}
|
|
* @name jibo.loader.AssetManager#cache
|
|
* @readOnly
|
|
* @private
|
|
*/
|
|
|
|
/**
|
|
* Resource loader for doing remote requests.
|
|
* @type {jibo.loader.RemoteLoader}
|
|
* @name jibo.loader.AssetManager#resourceLoader
|
|
* @private
|
|
*/
|
|
|
|
/**
|
|
* Resource loader for doing filesystem requests.
|
|
* @type {jibo.loader.LocalLoader}
|
|
* @name jibo.loader.AssetManager#localLoader
|
|
* @private
|
|
*/
|
|
|
|
/**
|
|
* The maximum number of loads to do at once.
|
|
* @type {Number}
|
|
* @name jibo.loader.AssetManager#maxDefaultLoads
|
|
* @default 4
|
|
*/
|
|
|
|
/**
|
|
* Registers new tasks types. These tasks must extend Task.
|
|
* @method jibo.loader.AssetManager#register
|
|
* @private
|
|
* @param {Function|String} TaskClass The class task reference.
|
|
* @param {int} [priority=0] The priority. Higher priority tasks
|
|
* are tested first. More general tasks should be lower
|
|
* and more specific tasks should be higher.
|
|
*/
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* Cancel all current loads.
|
|
* @method jibo.loader.AssetManager#cancelAll
|
|
*/
|
|
|
|
/**
|
|
* Destroys the AssetManager.
|
|
* @method jibo.loader.AssetManager#destroy
|
|
*/
|
|
|
|
/**
|
|
* Stashes the load for use later.
|
|
* @method jibo.loader.AssetManager#cancel
|
|
* @param {jibo.loader.AssetLoad} load The load to recycle.
|
|
*/
|
|
|
|
/**
|
|
* Gets either a new AssetLoad or a recycled one.
|
|
* @method jibo.loader.AssetManager#_getLoad
|
|
* @private
|
|
* @return {AssetLoad} The load to use.
|
|
*/
|
|
|
|
/**
|
|
* Handler when a load is finished.
|
|
* @method jibo.loader.AssetManager#_onLoaded
|
|
* @private
|
|
* @param {jibo.loader.AssetManager~completeCallback} complete The function to call when done.
|
|
* @param {AssetLoad} load The current load.
|
|
* @param {*} The returned results.
|
|
*/ |