ajax timeout promise

Is there a way to set a timeout using the promise?

var loPromise = webix.ajax().timeout(nAjaxMaxTime).post(lcUrl …

And is there an option to set the timeout for a SYNC(). call?

thnx in advance

i saw there is an update (v.2.5) … and it should be in this version … :slight_smile:

not working with promise

You can use timeout API with sync calls, but I don’t think that it will work. (timeout uses native XHR timeout property and it doesn’t work for sync calls )

As for the promise, yep, sure, the post command will return promise, which will be rejected if data is not returned in the defined time frame.

var loPromise = webix.ajax().timeout(nAjaxMaxTime).post(lcUrl, “hwid=” + obj.parent.deviceId + “&htid=” + obj.parent.htid + lcCmd); //

nAjaxMaxTime is set to 20000

this command give an ERROR when added : “timeout(nAjaxMaxTime).”
works well whitout “timeout(nAjaxMaxTime).”

webix_debug.js stops at line: 2509 /2506

" if (this._timeout)
x.timeout = this._timeout;
"

x.timeout << undefined

Can you please confirm, is issue occur in IE only?

i have to try it again while we found out that in WEBIX_debug.js at line 2492

var is_error = x.status >= 400 || x.status === 0;

" || status === 0" causes errors . > invoking “onAjaxError”

We are using the Webix to build a Android ‘webApp’ application.
We have got a IE and Chrome to test , build the main goal is the WebApp.

result on Android Tablet:
x.status: 0 – From line 2491 of file:///android_asset/codebase/webix_debug.js
IE: false –
Webkit: true
Safari: undefined –
FF: false –
Edge: false –

As far as I know all modern browsers return a valid xhr.status for not-aborted request. Is above occur for the Android web view only ?

the timeOut problem seems only to appear on IE (method not supported) at line 2516 (webix_debug)

No errors in Chrome and on the Android tablet.

the onAjaxError , status: 0 -

appears only in the Android WebView enviroment (not in Chrome, not in IE)

the response contents is the data we expecting… but the response code is zero (0) !

I change the Debug line into :

var is_error = x.status >= 400 || (!webix.env.isWebKit && x.status === 0);

We will fix the bug with timeout and IE, fix will be included in the next build.

As for status code this is not so simple, as status == 0 can be a signal of aborted XHR request in case of Webkit. We will investigate this issue.