由网友(断忆)分享简介:我需要更新的时候在我的的setInterval 。该值是由的setInterval 正在执行函数返回。I need to update the time in my setInterval. The value is returned by the function that setInterval is execu...
我需要更新的时候在我的的setInterval
。该值是由的setInterval
正在执行函数返回。
I need to update the time in my setInterval
. The value is returned by the function that setInterval
is executing.
read_log();
返回一个整数
var loop = setInterval(function(){count = read_log();}, count);
这将返回计数
是undefiend。所以,我需要得到计数并将其传递给的setInterval
This returns that count
is undefiend. So I need to get the count and pass it to setInterval
推荐答案
如果您需要在每次调用 read_log()
后更改重复间隔,你不能使用的setInterval()
- 使用一类常重复。你需要使用的setTimeout
,所以你可以在每次更换周期:
If you need to change the repetition interval after each call to read_log()
, you can't use setInterval()
-- that uses a constent repetition. You need to use setTimeout
, so you can change the period each time:
function call_read_log() {
var count = read_log();
setTimeout(call_read_log, count);
}
call_read_log();
相关推荐
最新文章