Is there a way to find out that the browser is actively using If and This can be detected as we know the If you want to run it continuously, then you can insert a mechanism like this: Note that the rate reduction for requestAnimationFrame is not part of the standard and it is a browser Exclusive is the implementation. requestAnimationFrame ? P> For example when I switch from tab to one running
requestAnimationFrame , the function closes, when I turn it back on, the best way to deal with it What is it?
requestAnimationFrame is running 100% then you can check that :
window.addEventListener ('blur', function () {// full not running}, false);
window.addEventListener ('focus', function) (// optimal running (if used)}, false) ;
requestAnimationFrame trigger rate (in most browsers) reduces when the window (tab) is not active ( IF is being used - it really depends on the code
requestAnimationFrame ).
var isActiveTab = true; // function myLoop () {// Update with the events above my cool stuff is here (ifActiveTab) {requestAnimationFrame (myLoop); } Else {setTimeout (myLoop, 16); // Apply force (vblank sync is not required / when the display is not updated}}
No comments:
Post a Comment