var timeout;
function animate()
{
// do stuff here
clearTimeout(timeout);
timeout=setTimeout(animate,2500);
}
This is an example which settimeout works fine, in fact, it just clear a time before we call it.and another solution is to do like this:
function test(){
...
if (....){
setTimeout(function(){test();}, 1000);
}
}
or ,we can not this more easily:function test(){
...
if (....){
setTimeout(test, 1000);
}
}
further more,window.setTimeout('window.parent.generateOutput(true)', 1000); // deprecatedis deprecated. So it explain why it works sometimes for the older version of spoop.
you can see the reference :
https://developer.mozilla.org/en/DOM/window.setTimeout
评论
发表评论