datasource-local.js revision 6608a5406cae6b74c06f0a501e189d1fc173dc21
* @value "DataSource.Local" NAME:
"DataSource.Local",
///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// * @description Pointer to live data. * Global transaction counter. * @property DataSource._tId * Executes a given callback. The third param determines whether to execute * @method DataSource.issueCallback * @param callback {Object} The callback object. * @param params {Array} params to be passed to the callback method * @param error {Boolean} whether an error occurred <dt>interval {Number}</dt> <dd>Interval ID of in-progress queue.</dd> <dd>In-progress connection identifier (if applicable).</dd> <dt>requests {Object[]}</dt> <dd>Array of queued request objects: {request:oRequest, callback:_xhrCallback}.</dd> * @default {interval:null, conn:null, requests:[]} * @description Internal init() handler. * @description Internal destroy() handler. * @description This method creates all the events for this module * Target and publishes them so we get Event Bubbling. * Fired when a data request is received. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * @preventable _defRequestFn //this.publish("request", {defaultFn: this._defRequestFn}); * Fired when raw data is received. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * <dt>data (Object)</dt> <dd>The raw data.</dd> * @preventable _defDataFn //this.publish("data", {defaultFn: this._defDataFn}); * Fired when response is returned. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * <dt>data (Object)</dt> <dd>The raw data.</dd> * <dt>results (Object)</dt> <dd>Parsed results.</dd> * <dt>meta (Object)</dt> <dd>Parsed meta results data.</dd> * <dt>error (Boolean)</dt> <dd>Error flag.</dd> * @preventable _defResponseFn //this.publish("response", {defaultFn: this._defResponseFn}); * Fired when an error is encountered. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * <dt>data (Object)</dt> <dd>The raw data (if available).</dd> * <dt>results (Object)</dt> <dd>Parsed results (if available).</dd> * <dt>meta (Object)</dt> <dd>Parsed meta results data (if available).</dd> * <dt>error (Boolean)</dt> <dd>Error flag.</dd> * event when response is received. This method should be implemented by * subclasses to achieve more complex behavior such as accessing remote data. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> this.
fire(
"error",
null, o);
* Normalizes raw data into a response that includes results and meta properties. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * <dt>data (Object)</dt> <dd>The raw response data.</dd> // Pass through data as-is this.
fire(
"response",
null, o);
* Sends data as a normalized response to callback. * @param e {Event.Facade} Event Facade. * @param o {Object} Object with the following properties: * <dt>tId (Number)</dt> <dd>Unique transaction ID.</dd> * <dt>request (Object)</dt> <dd>The request.</dd> * <dt>callback (Object)</dt> <dd>The callback object.</dd> * <dt>data (Object)</dt> <dd>Raw data.</dd> * <dt>results (Object)</dt> <dd>Parsed results.</dd> * <dt>meta (Object)</dt> <dd>Parsed meta data.</dd> // Send the response back to the callback * Generates a unique transaction ID and fires <code>request</code> event. * @param request {Object} Request. * @param callback {Object} An object literal with the following properties: * <dt><code>success</code></dt> * <dd>The function to call when the data is ready.</dd> * <dt><code>failure</code></dt> * <dd>The function to call upon a response failure condition.</dd> * <dt><code>scope</code></dt> * <dd>The object to serve as the scope for the success and failure handlers.</dd> * <dt><code>argument</code></dt> * <dd>Arbitrary data payload that will be passed back to the success and failure handlers.</dd> * @return {Number} Transaction ID.