darsain/fpsmeter

can cancel random requestAnimFrame() calback on hide()/pause()

Opened this issue · 1 comments

frameID is assigned setTimeout() handle in requestRender() and then
cancelAnimationFrame(frameID) is called in pause().

Handles from setTimeout() should not be used with cancelAnimationFrame().

In my case, where I created and hided FPSMetter at game start, it killed PIXI's requestAnimationFrame callback sometimes. Chances to get handles with same value from setTimeout() and requestAnimationFrame() are high at application start.

Same issues here, when using this with PIXI, PIXI.ticker.shared's _tick callback is canceled because of this bug.