datasource-io-min.js revision 550a487c1a9f2ed0b47672fe6521a0a2067483b0
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav GlassYUI.add("datasource-io",function(B){var A=function(){A.superclass.constructor.apply(this,arguments);};B.mix(A,{NAME:"dataSourceIO",ATTRS:{io:{value:B.io,cloneDefaultValue:false},ioConfig:{value:null}}});B.extend(A,B.DataSource.Local,{initializer:function(C){this._queue={interval:null,conn:null,requests:[]};},successHandler:function(F,C,E){var D=this.get("ioConfig");delete B.DataSource.Local.transactions[E.tId];this.fire("data",B.mix({data:C},E));if(D&&D.on&&D.on.success){D.on.success.apply(D.context||B,arguments);}},failureHandler:function(F,C,E){var D=this.get("ioConfig");delete B.DataSource.Local.transactions[E.tId];E.error=new Error("IO data failure");this.fire("data",B.mix({data:C},E));if(D&&D.on&&D.on.failure){D.on.failure.apply(D.context||B,arguments);}},_queue:null,_defRequestFn:function(G){var F=this.get("source"),H=this.get("io"),D=this.get("ioConfig"),E=G.request,C=B.merge(D,G.cfg,{on:B.merge(D,{success:this.successHandler,failure:this.failureHandler}),context:this,"arguments":G});if(B.Lang.isString(E)){if(C.method&&(C.method.toUpperCase()==="POST")){C.data=C.data?C.data+E:E;}else{F+=E;}}B.DataSource.Local.transactions[G.tId]=H(F,C);return G.tId;}});B.DataSource.IO=A;},"@VERSION@",{requires:["datasource-local","io"]});