File:LoaderQueueItem.js
/**
* @module cloudkid
*/
(function(){
"use strict";
/**
* Represents a single item in the loader queue
*
* @class LoaderQueueItem
*/
var LoaderQueueItem = function(){};
/** Reference to the prototype */
var p = LoaderQueueItem.prototype;
/**
* Highest priority
* @static
* @public
* @final
* @property {int} PRIORITY_HIGH
*/
LoaderQueueItem.PRIORITY_HIGH = 1;
/**
* Normal priority, the default
* @static
* @public
* @final
* @property {int} PRIORITY_NORMAL
*/
LoaderQueueItem.PRIORITY_NORMAL = 0;
/**
* Lowest priority
* @static
* @public
* @final
* @property {int} PRIORITY_LOW
*/
LoaderQueueItem.PRIORITY_LOW = -1;
/**
* The url of the load
* @public
* @property {string} url
*/
p.url = null;
/**
* Data associate with the load
* @public
* @property {*} data
*/
p.data = null;
/**
* The callback function of the load, to call when
* the load as finished, takes one argument as result
* @public
* @property {function} callback
*/
p.callback = null;
/**
* The priority of this item
* @property {int} priority
* @public
*/
p.priority = 0;
/**
* The amount we've loaded so far, from 0 to 1
* @public
* @property {Number} progress
*/
p.progress = 0;
/**
* The progress callback
* @public
* @proprty {function} updateCallback
*/
p.updateCallback = null;
p._boundFail = null;
p._boundProgress = null;
p._boundComplete = null;
/**
* Represent this object as a string
* @public
* @method toString
* @return {string} The string representation of this object
*/
p.toString = function()
{
return "[LoaderQueueItem(url:'"+this.url+"', priority:"+this.priority+")]";
};
/**
* Destroy this result
* @public
* @method destroy
*/
p.destroy = function()
{
this.callback = null;
this.updateCallback = null;
this.data = null;
this._boundFail = null;
this._boundProgress = null;
this._boundComplete = null;
};
// Assign to the name space
namespace('cloudkid').LoaderQueueItem = LoaderQueueItem;
}());