Consider mouse-clicking as user activity

It's a bit non-sensical that moving the mouse constitutes user activity, but
clicking it does not. Fix it.
This commit is contained in:
Richard van der Hoff 2016-02-12 10:19:01 +00:00
parent 605c567fde
commit 3e8cb47abe

View file

@ -30,6 +30,7 @@ class UserActivity {
* Start listening to user activity * Start listening to user activity
*/ */
start() { start() {
document.onmousedown = this._onUserActivity.bind(this);
document.onmousemove = this._onUserActivity.bind(this); document.onmousemove = this._onUserActivity.bind(this);
document.onkeypress = this._onUserActivity.bind(this); document.onkeypress = this._onUserActivity.bind(this);
// can't use document.scroll here because that's only the document // can't use document.scroll here because that's only the document
@ -46,6 +47,7 @@ class UserActivity {
* Stop tracking user activity * Stop tracking user activity
*/ */
stop() { stop() {
document.onmousedown = undefined;
document.onmousemove = undefined; document.onmousemove = undefined;
document.onkeypress = undefined; document.onkeypress = undefined;
window.removeEventListener('wheel', this._onUserActivity.bind(this), true); window.removeEventListener('wheel', this._onUserActivity.bind(this), true);