Setinterval timer ever 1 ms
Hi there, This line: https://github.com/jakiestfu/Snap.js/blob/develop/snap.js#L207
cache.animatingInterval = setInterval(function() {
utils.dispatchEvent('animating');
}, 1);
Sets an interval timer on every 1 ms, why so high? Leave the browser window from ownCloud open for a while, and you will notice the page is getting slow.
Current i fix this by doing:
var highestTimeoutId = setTimeout(";");
for (var i = 0; i < highestTimeoutId; i++) {
clearTimeout(i);
}
Snap = null
You can get the latest version in v2.0.0-rc1 branch. https://github.com/jakiestfu/Snap.js/tree/v2.0.0-rc1
Please publish this release since this behaviour is hidden in the current version, and slow down mobile apps that use it.
The solution in v2.0.0-rc1 is to remove the animating action hook? Does a hook exists which I can trigger just while the menu is opened?
still happening here with 2.0.9: https://github.com/nextcloud/server/issues/21459
what I don't understand is why "easeTo" is being called even though nothing is happening. I'd expect this animation thing to be called only when something is happening.
I wonder if this setInterval shouldn't simply be a setTimeout so it only sends the event once to notify listeners that animation has started. No need to send it for every frame.
But still: why does the animation never stop ? Maybe the event that the lib listens to is not fired.
I tried adding console.log and with NC I see only this:
close()
easeTo(0)
no callback called. maybe there was no transition in the first place ?
it seems that it doesn't like it when we tell it to ease to a position it's already in. I managed to reduce the damage by adding a check in the caller to "not close if already closed", etc.
But in general I'd expected such checks to exist in the library.
It seems that if on triggers open or close while an animation is not finished, it will also create an unfinishable ease animation. This is the case in Nextcloud where we wired up the trigger button to the enter key, so going wild with the enter key during an animation can trigger further easeTo scenarios.