/*
 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(Y){var DSGet=function(){DSGet.superclass.constructor.apply(this,arguments);};Y.DataSource.Get=Y.extend(DSGet,Y.DataSource.Local,{_defRequestFn:function(e){var uri=this.get("source"),get=this.get("get"),guid=Y.guid().replace(/\-/g,'_'),generateRequest=this.get("generateRequestCallback"),o;this._last=guid;YUI.Env.DataSource.callbacks[guid]=Y.bind(function(response){delete YUI.Env.DataSource.callbacks[guid];delete Y.DataSource.Local.transactions[e.tId];var process=this.get('asyncMode')!=="ignoreStaleResponses"||this._last===guid;if(process){this.fire("data",Y.mix({data:response},e));}else{}},this);uri+=e.request+generateRequest.call(this,guid);Y.DataSource.Local.transactions[e.tId]=get.script(uri,{autopurge:true,onFailure:Y.bind(function(e,o){delete YUI.Env.DataSource.callbacks[guid];delete Y.DataSource.Local.transactions[e.tId];e.error=new Error(o.msg||"Script node data failure");this.fire("data",e);},this,e),onTimeout:Y.bind(function(e,o){delete YUI.Env.DataSource.callbacks[guid];delete Y.DataSource.Local.transactions[e.tId];e.error=new Error(o.msg||"Script node data timeout");this.fire("data",e);},this,e)});return e.tId;},_generateRequest:function(guid){return"&"+this.get("scriptCallbackParam")+"=YUI.Env.DataSource.callbacks."+guid;}},{NAME:"dataSourceGet",ATTRS:{get:{value:Y.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']});