mirror of
https://github.com/element-hq/element-web
synced 2024-11-22 17:25:50 +03:00
Merge pull request #2769 from matrix-org/dbkr/fix_instant_rrs
Fix erroneously sending RRs, pt1.
This commit is contained in:
commit
2e081982ee
1 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2015, 2016 OpenMarket Ltd
|
||||||
|
Copyright 2019 New Vector Ltd
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -33,7 +34,7 @@ class UserActivity {
|
||||||
this._attachedTimers = [];
|
this._attachedTimers = [];
|
||||||
this._activityTimeout = new Timer(CURRENTLY_ACTIVE_THRESHOLD_MS);
|
this._activityTimeout = new Timer(CURRENTLY_ACTIVE_THRESHOLD_MS);
|
||||||
this._onUserActivity = this._onUserActivity.bind(this);
|
this._onUserActivity = this._onUserActivity.bind(this);
|
||||||
this._onDocumentBlurred = this._onDocumentBlurred.bind(this);
|
this._onWindowBlurred = this._onWindowBlurred.bind(this);
|
||||||
this._onPageVisibilityChanged = this._onPageVisibilityChanged.bind(this);
|
this._onPageVisibilityChanged = this._onPageVisibilityChanged.bind(this);
|
||||||
this.lastScreenX = 0;
|
this.lastScreenX = 0;
|
||||||
this.lastScreenY = 0;
|
this.lastScreenY = 0;
|
||||||
|
@ -74,8 +75,8 @@ class UserActivity {
|
||||||
document.onmousemove = this._onUserActivity;
|
document.onmousemove = this._onUserActivity;
|
||||||
document.onkeydown = this._onUserActivity;
|
document.onkeydown = this._onUserActivity;
|
||||||
document.addEventListener("visibilitychange", this._onPageVisibilityChanged);
|
document.addEventListener("visibilitychange", this._onPageVisibilityChanged);
|
||||||
document.addEventListener("blur", this._onDocumentBlurred);
|
window.addEventListener("blur", this._onWindowBlurred);
|
||||||
document.addEventListener("focus", this._onUserActivity);
|
window.addEventListener("focus", this._onUserActivity);
|
||||||
// can't use document.scroll here because that's only the document
|
// can't use document.scroll here because that's only the document
|
||||||
// itself being scrolled. Need to use addEventListener's useCapture.
|
// itself being scrolled. Need to use addEventListener's useCapture.
|
||||||
// also this needs to be the wheel event, not scroll, as scroll is
|
// also this needs to be the wheel event, not scroll, as scroll is
|
||||||
|
@ -116,7 +117,7 @@ class UserActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDocumentBlurred() {
|
_onWindowBlurred() {
|
||||||
this._activityTimeout.abort();
|
this._activityTimeout.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue