fixed retry invokation for calling setState
to successfully call a function with parameters by setTimeout, it needs to be a function that will be called by setTimeout internally. this patch actually enables multiple tries for calling the setState function.
This commit is contained in:
committed by
Jonas Jelten
parent
49f3eb3bc4
commit
3de30aba2e
@@ -156,7 +156,7 @@ var JSInput = (function ($, undefined) {
|
||||
// only application that has ever used JSInput, jsVGL. Something
|
||||
// more sturdy should be put in place.
|
||||
function whileloop(n) {
|
||||
if (n < 5){
|
||||
if (n > 0){
|
||||
try {
|
||||
if (sop) {
|
||||
_deepKey(cWindow, stateSetter)(stateValue);
|
||||
@@ -169,14 +169,14 @@ var JSInput = (function ($, undefined) {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
setTimeout(whileloop(n+1), 200);
|
||||
setTimeout(function() { whileloop(n - 1); }, 200);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.debug("Error: could not set state");
|
||||
}
|
||||
}
|
||||
whileloop(0);
|
||||
whileloop(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,4 +217,4 @@ var JSInput = (function ($, undefined) {
|
||||
walkDOM: walkDOM
|
||||
};
|
||||
|
||||
})(window.jQuery);
|
||||
})(window.jQuery);
|
||||
|
||||
Reference in New Issue
Block a user