Mark touch events as passive

This commit is contained in:
Pavel Djundik 2017-04-30 13:42:59 +03:00 committed by Jérémie Astori
parent 518160a1fa
commit 7ec0dcfec8
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8

View File

@ -23,7 +23,7 @@ module.exports = function slideoutMenu(viewport, menu) {
function onTouchStart(e) { function onTouchStart(e) {
if (e.touches.length !== 1) { if (e.touches.length !== 1) {
onTouchEnd(); onTouchEnd();
return false; return;
} }
var touch = e.touches.item(0); var touch = e.touches.item(0);
@ -37,7 +37,7 @@ module.exports = function slideoutMenu(viewport, menu) {
touchStartTime = Date.now(); touchStartTime = Date.now();
viewport.addEventListener("touchmove", onTouchMove); viewport.addEventListener("touchmove", onTouchMove);
viewport.addEventListener("touchend", onTouchEnd); viewport.addEventListener("touchend", onTouchEnd, {passive: true});
} }
} }
@ -91,7 +91,7 @@ module.exports = function slideoutMenu(viewport, menu) {
menuIsMoving = false; menuIsMoving = false;
} }
viewport.addEventListener("touchstart", onTouchStart); viewport.addEventListener("touchstart", onTouchStart, {passive: true});
return { return {
disable: disableSlideout, disable: disableSlideout,