How can I make setInterval also work when a tab is inactive in Chrome?

后端 未结 13 1988
被撕碎了的回忆
被撕碎了的回忆 2020-11-21 09:59

I have a setInterval running a piece of code 30 times a second. This works great, however when I select another tab (so that the tab with my code becomes inacti

13条回答
  •  旧时难觅i
    2020-11-21 10:40

    I was able to call my callback function at minimum of 250ms using audio tag and handling its ontimeupdate event. Its called 3-4 times in a second. Its better than one second lagging setTimeout

提交回复
热议问题