/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.3.0
build: 3167
*/
YUI.add("datasource-get",function(B){var A=function(){A.superclass.constructor.apply(this,arguments);};B.DataSource.Get=B.extend(A,B.DataSource.Local,{_defRequestFn:function(G){var F=this.get("source"),D=this.get("get"),C=B.guid().replace(/\-/g,"_"),E=this.get("generateRequestCallback"),H;this._last=C;YUI.Env.DataSource.callbacks[C]=B.bind(function(I){delete YUI.Env.DataSource.callbacks[C];delete B.DataSource.Local.transactions[G.tId];var J=this.get("asyncMode")!=="ignoreStaleResponses"||this._last===C;if(J){this.fire("data",B.mix({data:I},G));}else{}},this);F+=G.request+E.call(this,C);B.DataSource.Local.transactions[G.tId]=D.script(F,{autopurge:true,onFailure:B.bind(function(I,J){delete YUI.Env.DataSource.callbacks[C];delete B.DataSource.Local.transactions[I.tId];I.error=new Error(J.msg||"Script node data failure");this.fire("data",I);},this,G),onTimeout:B.bind(function(I,J){delete YUI.Env.DataSource.callbacks[C];delete B.DataSource.Local.transactions[I.tId];I.error=new Error(J.msg||"Script node data timeout");this.fire("data",I);},this,G)});return G.tId;},_generateRequest:function(C){return"&"+this.get("scriptCallbackParam")+"=YUI.Env.DataSource.callbacks."+C;}},{NAME:"dataSourceGet",ATTRS:{get:{value:B.Get,cloneDefaultValue:false},asyncMode:{value:"allowAll"},scriptCallbackParam:{value:"callback"},generateRequestCallback:{value:function(){return this._generateRequest.apply(this,arguments);}}}});YUI.namespace("Env.DataSource.callbacks");},"3.3.0",{requires:["datasource-local","get"]});