/*!
- * Ext JS Library 3.0.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
*/
\r
/**\r
* @cfg {Number} maxRetries\r
- * Number of times to re-attempt delivery on failure of a call.\r
+ * Number of times to re-attempt delivery on failure of a call. Defaults to <tt>1</tt>.\r
*/\r
maxRetries: 1,\r
+ \r
+ /**\r
+ * @cfg {Number} timeout\r
+ * The timeout to use for each request. Defaults to <tt>undefined</tt>.\r
+ */\r
+ timeout: undefined,\r
\r
constructor : function(config){\r
Ext.direct.RemotingProvider.superclass.constructor.call(this, config);\r
* @param {Ext.direct.RemotingProvider} provider\r
* @param {Ext.Direct.Transaction} transaction\r
*/ \r
- 'beforecall',\r
+ 'beforecall', \r
/**\r
* @event call\r
* Fires immediately after the request to the server-side is sent. This does\r
*/ \r
'call'\r
);\r
- this.namespace = (typeof this.namespace === 'string') ? Ext.ns(this.namespace) : this.namespace || window;\r
+ this.namespace = (Ext.isString(this.namespace)) ? Ext.ns(this.namespace) : this.namespace || window;\r
this.transactions = {};\r
this.callBuffer = [];\r
},\r
initAPI : function(){\r
var o = this.actions;\r
for(var c in o){\r
- var cls = this.namespace[c] || (this.namespace[c] = {});\r
- var ms = o[c];\r
+ var cls = this.namespace[c] || (this.namespace[c] = {}),\r
+ ms = o[c];\r
for(var i = 0, len = ms.length; i < len; i++){\r
var m = ms[i];\r
cls[m.name] = this.createMethod(c, m);\r
if(success){\r
var events = this.getEvents(xhr);\r
for(var i = 0, len = events.length; i < len; i++){\r
- var e = events[i];\r
- var t = this.getTransaction(e);\r
+ var e = events[i],\r
+ t = this.getTransaction(e);\r
this.fireEvent('data', this, e);\r
if(t){\r
this.doCallback(t, e, true);\r
url: this.url,\r
callback: this.onData,\r
scope: this,\r
- ts: data\r
- };\r
+ ts: data,\r
+ timeout: this.timeout\r
+ }, callData;\r
\r
- // send only needed data\r
- var callData;\r
if(Ext.isArray(data)){\r
callData = [];\r
for(var i = 0, len = data.length; i < len; i++){\r
\r
if(this.enableUrlEncode){\r
var params = {};\r
- params[typeof this.enableUrlEncode == 'string' ? this.enableUrlEncode : 'data'] = Ext.encode(callData);\r
+ params[Ext.isString(this.enableUrlEncode) ? this.enableUrlEncode : 'data'] = Ext.encode(callData);\r
o.params = params;\r
}else{\r
o.jsonData = callData;\r
if(!this.callTask){\r
this.callTask = new Ext.util.DelayedTask(this.combineAndSend, this);\r
}\r
- this.callTask.delay(typeof this.enableBuffer == 'number' ? this.enableBuffer : 10);\r
+ this.callTask.delay(Ext.isNumber(this.enableBuffer) ? this.enableBuffer : 10);\r
}else{\r
this.combineAndSend();\r
}\r
doCallback: function(t, e){\r
var fn = e.status ? 'success' : 'failure';\r
if(t && t.cb){\r
- var hs = t.cb;\r
- var result = e.result || e.data;\r
+ var hs = t.cb,\r
+ result = Ext.isDefined(e.result) ? e.result : e.data;\r
if(Ext.isFunction(hs)){\r
hs(result, e);\r
} else{\r