开发者

setTimeout is not working when Windows goes to sleep mode and then wake up

I have noticed this in Chrome. Has anyone an idea abo开发者_如何学编程ut what's wrong or a workaround?


You can use setInterval instead - it keeps on running. If you need a one-shot solution, use clearInterval to delete the timer. setInterval will fire immediately if the computer was asleep while the event should have been fired. I tested this behavior in Chrome, Firefox and Internet Explorer. As an example, have look at http://blaeul.de/de/content/javascript-timer-test and its source.


When Chrome goes in the background it freezes JavaScript execution. I noticed this on drawings when it's minimized to the Dock in OS X.


There is no workaround as far as I know. If you tell us what you are trying to do there might be something that can be done.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜