Jump to content

Switching between requestAnimationFrame and setTimeout at run time


tommitytom
 Share

Recommended Posts

Hi folks!

So I'm working on an online game, and I'd like the game to continue running when the user changes tabs in their browser.  I can get around the issue by adding forceSetTimeout: true to my config but it makes gameplay quite janky.  Ideally I would use RAF, detect when a tab has changed, and switch to using the setTimeout method... and move back to using RAF once the user opens the tab up again.  Is there anything in place for handling this?  I know it's theoretically possible since I've worked with RAF and raw canvas in the past, I was just curious about the best method to approach this with Phaser.

And before someone suggests it, I'm already setting disableVisibilityChange = true in my config to account for the game losing focus :)  However this is not about losing focus, but changing tabs.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...