2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhemweb.js: iOS fix, version#2 (Forum #116962)

git-svn-id: https://svn.fhem.de/fhem/trunk@23406 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2020-12-22 21:48:02 +00:00
parent ee8a6c68a0
commit 95c36d60ad

View File

@ -555,6 +555,7 @@ FW_csrfRefresh(callback)
});
}
var FW_cmdStack=[];
function
FW_cmd(arg, callback, rep)
{
@ -573,13 +574,16 @@ FW_cmd(arg, callback, rep)
callback(req.responseText);
else if(req.responseText)
FW_errmsg(req.responseText, 5000);
var todo = FW_cmdStack.shift();
if(todo) {
log("FW_cmd retry #"+todo.rep);
FW_cmd(todo.arg, todo.callback, todo.rep);
}
},
error:function(xhr, status, err) {
// iOS 13+ is not queueing requests, have to do it myself. Forum #116962
if(xhr.status == 0 && xhr.readyState == 0 && (!rep || rep < 10)) {
rep = (rep ? rep+1 : 1);
log("FW_cmd retry #"+rep);
setTimeout(function(){FW_cmd(arg, callback, rep)}, 200);
FW_cmdStack.push({ arg:arg, callback:callback, rep:(rep?rep+1:1)});
} else if(xhr.status == 400 && typeof FW_csrfToken != "undefined") {
FW_csrfToken = "";