Chrome: timeouts/interval suspended in background tabs?

后端 未结 6 1489
清酒与你
清酒与你 2020-11-22 02:47

I was testing the accuracy of setTimeout using this test. Now I noticed that (as expected) setTimeout is not very accurate but for most appliances

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 03:32

    There is a solution to use Web Workers, because they run in separate process and are not slowed down

    I've written a tiny script that can be used without changes to your code - it simply overrides functions setTimeout, clearTimeout, setInterval, clearInterval

    Just include it before all your code

    http://github.com/turuslan/HackTimer

提交回复
热议问题