setInterval的最大延迟是多少? [英] What is the maximum delay for setInterval?
问题描述
我在Firefox 15和Chrome 21上遇到以下代码问题:
I'm having problems on Firefox 15 and Chrome 21 with the following code:
setInterval(function () { console.log('test') }, 300000000000)
在这两种浏览器上,该功能立即运行很快就重复了。当然,这是一个很大的数字(代表从现在开始大约10年),但我不认为它被视为微小或负数。我没有看到任何文档中允许的最大延迟。有没有人知道是否有标准最大值,或者这只是浏览器有趣吗?
On both browsers, the function is run right away repeats very quickly. Sure, that's a big number (representing about 10 years from now), but I wouldn't expect it to be treated as a tiny or negative number. I haven't seen a maximum allowed delay in any documentation. Does anyone know if there's a standard max, or if this is just the browsers being funny?
推荐答案
我找不到任何目前的文档,但如果定时器值必须符合32位有符号整数,我不会感到惊讶。
I can't find any documentation at the moment, but I wouldn't be surprised if the timer value had to fit in a 32-bit signed integer.
这篇关于setInterval的最大延迟是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!