datasource-base-min.js revision 1bc27dc58fd882eb8902cdefa2dde4a8ee2a5bbd
YUI.add("datasource-base",function(D){D.namespace("DataSource");var C=D.DataSource,A=D.Lang,B=function(){B.superclass.constructor.apply(this,arguments);};D.mix(C,{_tId:0,ERROR_DATANULL:0,ERROR_DATAINVALID:1});D.mix(B,{NAME:"DataSource.Base",ATTRS:{source:{value:null},ERROR_DATAINVALID:{value:"Invalid data"},ERROR_DATANULL:{value:"Null data"}},issueCallback:function(F){if(F.callback){var G=F.callback.scope||window,E=(F.error&&F.callback.failure)||F.callback.success;if(E){E.apply(G,[F]);}}}});D.extend(B,D.Base,{_queue:null,initializer:function(){this._queue={interval:null,conn:null,requests:[]};this._initEvents();},destructor:function(){},_initEvents:function(){this.publish("request",{defaultFn:this._handleRequest});this.publish("data",{defaultFn:this._handleData});this.publish("response",{defaultFn:this._handleResponse});},_handleRequest:function(F,G){var E=this.get("source");if(A.isUndefined(E)){G.error=true;}if(G.error){this.fire("error",null,G);}this.fire("data",null,D.mix(G,{data:E}));},_handleData:function(E,F){F.results=F.data;if(!F.results){F.results=[];}if(!F.meta){F.meta={};}this.fire("response",null,F);},_handleResponse:function(E,F){B.issueCallback(F);},sendRequest:function(E,G){var F=C._tId++;this.fire("request",null,{tId:F,request:E,callback:G});return F;}});C.Base=B;},"@VERSION@",{requires:["base"]});