变通办法为FF5和铬setInterval(),setTimeout()在非活动选项卡 [英] workaround for FF5 and chrome setInterval(), setTimeout() in inactive tab

查看:176
本文介绍了变通办法为FF5和铬setInterval(),setTimeout()在非活动选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

js优化会导致非活动选项卡在ff5和chrome中减慢setInterval()和setTimeout()。我有它设置为66毫秒,但它达到1000时,该标签是无效的。



有方法可以确定多少时间过去的标签是无效的,但我需要js继续运行并执行操作,例如为某些事件播放声音。有没有什么办法来实现这一目标?

解决方案

这些钳位的整个目的是防止使用太多CPU的背景页面。什么事件,你究竟以15Hz进行,即使用户看不到标签,也需要播放声音?


There is js optimalization causing inactive tabs to slow down setInterval() and setTimeout() in ff5 and chrome. I have it set for 66 miliseconds but it goes up to 1000 whne tab is inactive.

There is way to determine how much time passed when the tab was inactive, but I need js keep running and performing actions, like playing sounds for some events. Is there any way to achive that?

解决方案

The whole point of those clamps is to keep background pages from using too much CPU. What events, exactly do you have going on in 15Hz that need to play sounds even though the user can't see the tab?

这篇关于变通办法为FF5和铬setInterval(),setTimeout()在非活动选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆