Make scrolling count as user activity.

pull/21833/head
David Baker 2016-01-08 22:19:31 +00:00
parent 7913b0b465
commit 1c4d1d2507
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,9 @@ class UserActivity {
start() {
document.onmousemove = this._onUserActivity.bind(this);
document.onkeypress = this._onUserActivity.bind(this);
// can't use document.scroll here because that's only the document
// itself being scrolled. Need to use addEventListener's useCapture.
window.addEventListener('scroll', this._onUserActivity.bind(this), true);
this.lastActivityAtTs = new Date().getTime();
this.lastDispatchAtTs = 0;
}
@ -41,6 +44,7 @@ class UserActivity {
stop() {
document.onmousemove = undefined;
document.onkeypress = undefined;
window.removeEventListener('scroll', this._onUserActivity.bind(this), true);
}
_onUserActivity(event) {