I want to run a function in TruClient (Firefox) every 0.1 seconds using window.setTimeout:
function foobar(delay_accumulator){
if(delay_accumulator >= 100)//10 seconds
return;
//do something
window.setTimeout(function() { foobar(delay_accumulator+1); }, 100);
}
foobar(0);
However, the step fails, giving the following error:
** 2: Evaluate JavaScript code function foobar(delay_accumula...OBAR"); foobar(0); ** failed - exception occured: NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMJSWindow.setTimeout]
Why is setTimeout not available? Is there an alternative solution I can use?
Edit: Truclient has a "wait" function in the toolbox, but this has a minimum granularity of 1 second as opposed to miliseconds for setTimeout.
Try the nsiTimer: https://developer.mozilla.org/en/nsITimer
User contributions licensed under CC BY-SA 3.0