From 3b433dfa8b7eb8c608c868145534d5ce2f98bd1d Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 10 Apr 2020 16:22:09 +0200 Subject: [PATCH 1/2] Add passive mode touch events, calms Lighthouse Refs: https://github.com/Mango/slideout/pull/291 https://github.com/Mango/slideout/pull/289 https://github.com/Mango/slideout/pull/267 --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 0449e40..afd11c2 100644 --- a/index.js +++ b/index.js @@ -206,7 +206,7 @@ Slideout.prototype._initTouchEvents = function() { } }; - doc.addEventListener(touch.move, this._preventMove); + doc.addEventListener(touch.move, this._preventMove, {passive: true}); /** * Resets values on touchstart @@ -222,7 +222,7 @@ Slideout.prototype._initTouchEvents = function() { self._preventOpen = (!self._touch || (!self.isOpen() && self.menu.clientWidth !== 0)); }; - this.panel.addEventListener(touch.start, this._resetTouchFn); + this.panel.addEventListener(touch.start, this._resetTouchFn, {passive: true}); /** * Resets values on touchcancel @@ -232,7 +232,7 @@ Slideout.prototype._initTouchEvents = function() { self._opening = false; }; - this.panel.addEventListener('touchcancel', this._onTouchCancelFn); + this.panel.addEventListener('touchcancel', this._onTouchCancelFn, {passive: true}); /** * Toggles slideout on touchend @@ -245,7 +245,7 @@ Slideout.prototype._initTouchEvents = function() { self._moved = false; }; - this.panel.addEventListener(touch.end, this._onTouchEndFn); + this.panel.addEventListener(touch.end, this._onTouchEndFn, {passive: true}); /** * Translates panel on touchmove @@ -297,7 +297,7 @@ Slideout.prototype._initTouchEvents = function() { }; - this.panel.addEventListener(touch.move, this._onTouchMoveFn); + this.panel.addEventListener(touch.move, this._onTouchMoveFn, {passive: true}); return this; }; From 90c433d8540e80e69d133ae1f4aa65cfd5cc19db Mon Sep 17 00:00:00 2001 From: inoas Date: Fri, 10 Apr 2020 16:58:20 +0200 Subject: [PATCH 2/2] fix CS, fix dist --- dist/slideout.js | 17 +++++++++-------- index.js | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dist/slideout.js b/dist/slideout.js index 4813bdf..55d3c20 100644 --- a/dist/slideout.js +++ b/dist/slideout.js @@ -1,4 +1,4 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Slideout=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o