From 3de30aba2e73f34894773ee04be980cd052e34ae Mon Sep 17 00:00:00 2001 From: Jonas Jelten Date: Thu, 17 Apr 2014 13:50:29 +0200 Subject: [PATCH] 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. --- common/static/js/capa/src/jsinput.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/static/js/capa/src/jsinput.js b/common/static/js/capa/src/jsinput.js index d54af46bbe..a10f18fa76 100644 --- a/common/static/js/capa/src/jsinput.js +++ b/common/static/js/capa/src/jsinput.js @@ -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); \ No newline at end of file +})(window.jQuery);