You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello and congratulations for this nice and sophisticated library!
I'm using a simple flip countdown (using one of the examples from pqina/flip). The countdown is created and destroyed dynamically. However after being destroyed (which is done with tickInstance.destroy()) I noticed an unusual high CPU usage.
After some investigation I found the problem: in the presentTick function in https://github.com/pqina/tick/blob/master/src/core/js/utils.js, draw is called recursively using requestAnimationFrame. This loop doesn't stop, even after the tick instance is destroyed.
I solved the problem with a quick and dirty monkey-patch:
after calling tickInstance.destroy(), set tickInstance._IS_DESTROYED = true;
in presentTick, check if the instance is destroyed before calling requestAnimationFrame, that is:
Hello and congratulations for this nice and sophisticated library!
I'm using a simple flip countdown (using one of the examples from pqina/flip). The countdown is created and destroyed dynamically. However after being destroyed (which is done with
tickInstance.destroy()
) I noticed an unusual high CPU usage.After some investigation I found the problem: in the
presentTick
function in https://github.com/pqina/tick/blob/master/src/core/js/utils.js,draw
is called recursively usingrequestAnimationFrame
. This loop doesn't stop, even after the tick instance is destroyed.I solved the problem with a quick and dirty monkey-patch:
tickInstance.destroy()
, settickInstance._IS_DESTROYED = true;
presentTick
, check if the instance is destroyed before callingrequestAnimationFrame
, that is:The CPU is now back to 0 as expected, so I'm pretty sure the problem was here.
Hopefully this problem can be solved in a future release.
Thanks for your time.
The text was updated successfully, but these errors were encountered: