Chrome: timeouts/interval suspended in background tabs?

后端 未结 6 1538
清酒与你
清酒与你 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:27

    I recently asked about this and it is behaviour by design. When a tab is inactive, only at a maximum of once per second the function is called. Here is the code change.

    Perhaps this will help: How can I make setInterval also work when a tab is inactive in Chrome?

    TL;DR: use Web Workers.

提交回复
热议问题