javascript - Minimum setInterval()/setTimeout() delay on background tabs -


possible duplicate:
chrome: timeouts/interval suspended in background tabs?

is there minimum allowed delay setinterval() , settimeout() when being run on tab you're not looking at?

this code runs setinterval() specified delay of 100ms , writes out how long delay was. reports when enter/leave tab.

<html> <body> <script type="text/javascript">  window.onfocus = function () { document.body.innerhtml += 'entered tab<br />'; }; window.onblur = function () { document.body.innerhtml += 'left tab<br />'; }; var previous = new date().gettime(); setinterval(function () {     var = new date().gettime();     var elapsed = - previous;     document.body.innerhtml += elapsed + '<br />';     previous = now; }, 100);  </script> </body> </html> 

here's excerpt of output on chrome 12.0.742.100 on ubuntu 10.04.2 lts:

101 101 101 left tab 1001 1000 1004 1003 1002 1000 entered tab 101 101 101 102 101 

i tried different values delay too. value less 1000 results in same behavior of being raised 1000 when you're looking @ different tab. values on 1000 behave correctly. , same thing happens settimeout() version of code.

i know example chrome, firefox @ least, firefox 5 release notes (under "what's new in firefox").

background tabs have settimeout , setinterval clamped 1000ms improve performance


oh, , realised has been asked in regard chrome, on here: chrome: timeouts/interval suspended in background tabs?. there's link there shows is true in chrome.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -