From c2f2fb38168101bf565b4d3b4cfd7b1e0571f721 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 6 Sep 2016 12:10:43 +0100 Subject: [PATCH] use passive event listener for mousewheel --- src/UserActivity.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UserActivity.js b/src/UserActivity.js index 5c80f4743e..e7338e17e9 100644 --- a/src/UserActivity.js +++ b/src/UserActivity.js @@ -37,7 +37,8 @@ class UserActivity { // itself being scrolled. Need to use addEventListener's useCapture. // also this needs to be the wheel event, not scroll, as scroll is // fired when the view scrolls down for a new message. - window.addEventListener('wheel', this._onUserActivity.bind(this), true); + window.addEventListener('wheel', this._onUserActivity.bind(this), + { passive: true, capture: true }); this.lastActivityAtTs = new Date().getTime(); this.lastDispatchAtTs = 0; this.activityEndTimer = undefined; @@ -50,7 +51,8 @@ class UserActivity { document.onmousedown = undefined; document.onmousemove = undefined; document.onkeypress = undefined; - window.removeEventListener('wheel', this._onUserActivity.bind(this), true); + window.removeEventListener('wheel', this._onUserActivity.bind(this), + { passive: true, capture: true }); } /**