You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Make scrolling count as user activity.
This commit is contained in:
@@ -31,6 +31,9 @@ class UserActivity {
|
|||||||
start() {
|
start() {
|
||||||
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
|
||||||
|
// itself being scrolled. Need to use addEventListener's useCapture.
|
||||||
|
window.addEventListener('scroll', this._onUserActivity.bind(this), true);
|
||||||
this.lastActivityAtTs = new Date().getTime();
|
this.lastActivityAtTs = new Date().getTime();
|
||||||
this.lastDispatchAtTs = 0;
|
this.lastDispatchAtTs = 0;
|
||||||
}
|
}
|
||||||
@@ -41,6 +44,7 @@ class UserActivity {
|
|||||||
stop() {
|
stop() {
|
||||||
document.onmousemove = undefined;
|
document.onmousemove = undefined;
|
||||||
document.onkeypress = undefined;
|
document.onkeypress = undefined;
|
||||||
|
window.removeEventListener('scroll', this._onUserActivity.bind(this), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onUserActivity(event) {
|
_onUserActivity(event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user