-
-
Notifications
You must be signed in to change notification settings - Fork 186
Memory leak with idle checking #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
When page is idle and mousemove to 'wake up', ifvisible.wakeUp(wakeUp) and 'mousemove' clear the same timer and set 2 timer. |
@AbelMakihara good catch. Here is an updated fix: Fix: trackIdleStatus = ->
timer = null # No array, just a reference to the last timeout id
wakeUp = ->
return ifvisible.wakeup() if status isnt "active"
clearTimeout(timer); # Clear previous timeout. A noop if the timeout already ran
idleStartedTime = +(new Date())
timer = setTimeout(->
ifvisible.idle() if status is "active"
, idleTime)
... |
is still on maintain ? |
I do believe this to be fixed in my fork https://github.com/rosskevin/ifvisible. If not please PR a test (expanded tests are present there) |
When idle checking is on, every mouse move, keystroke, and scroll event calls
wake
which iterates through an array of old timers and clears them (though only effectively clearing the last timer which would be the only one ever active). This array grows unbounded with each event. An array should not be used here.Current:
Fix:
The text was updated successfully, but these errors were encountered: