datasource-function.js revision 4de851bb1d7d556b60e05085a888a1cf06f2b271
/**
* The DataSource utility provides a common configurable interface for widgets to
* access a variety of data, from JavaScript arrays to online database servers.
*
* @module datasource
*/
/**
* Function subclass for the YUI DataSource utility.
* @class DataSource.Function
* @extends DataSource.Local
* @constructor
*/
DSFn = function() {
};
/////////////////////////////////////////////////////////////////////////////
//
// DataSource.Function static properties
//
/////////////////////////////////////////////////////////////////////////////
/**
* Class name.
*
* @property NAME
* @type String
* @static
* @final
* @value "DataSource.Function"
*/
NAME: "DataSource.Function",
/////////////////////////////////////////////////////////////////////////////
//
// DataSource.Function Attributes
//
/////////////////////////////////////////////////////////////////////////////
ATTRS: {
/**
* @attribute source
* @description Pointer to live data.
* @type MIXED
* @default null
*/
source: {
},
/**
* Context in which to execute the function. By default, is the DataSource
* instance itself. If set, the function will receive the DataSource instance
* as an additional argument.
*
* @property scope
* @type Object
* @default null
*/
context: {
value: null
}
}
});
/**
* Internal init() handler.
*
* @method initializer
* @param config {Object} Config object.
* @private
*/
initializer: function(config) {
},
/**
* Passes query string to IO. Fires <code>response</code> event when
* response is received asynchronously.
*
* @method _defRequestFn
* @param e {Event.Facade} Event Facade with the following properties:
* <dl>
* <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 with the following properties:
* <dl>
* <dt>success (Function)</dt> <dd>Success handler.</dd>
* <dt>failure (Function)</dt> <dd>Failure handler.</dd>
* <dt>scope (Object)</dt> <dd>Execution context.</dd>
* </dl>
* </dd>
* </dl>
* @protected
*/
_defRequestFn: function(e) {
if(fn) {
}
else {
this.fire("error", e);
}
return e.tId;
}
});
Y.DataSource.Function = DSFn;