If you just need swipe, you are better off size wise just using only the part you need. This should work on any touch device.
This is ~450 bytes' after gzip compression, minification, babel etc.
I wrote the below class based on the other answers, it uses percentage moved instead of pixels, and a event dispatcher pattern to hook/unhook things.
Use it like so:
const dispatcher = new SwipeEventDispatcher(myElement);
dispatcher.on('SWIPE_RIGHT', () => { console.log('I swiped right!') })
export class SwipeEventDispatcher {_x000D_
constructor(element, options = {}) {_x000D_
this.evtMap = {_x000D_
SWIPE_LEFT: [],_x000D_
SWIPE_UP: [],_x000D_
SWIPE_DOWN: [],_x000D_
SWIPE_RIGHT: []_x000D_
};_x000D_
_x000D_
this.xDown = null;_x000D_
this.yDown = null;_x000D_
this.element = element;_x000D_
this.options = Object.assign({ triggerPercent: 0.3 }, options);_x000D_
_x000D_
element.addEventListener('touchstart', evt => this.handleTouchStart(evt), false);_x000D_
element.addEventListener('touchend', evt => this.handleTouchEnd(evt), false);_x000D_
}_x000D_
_x000D_
on(evt, cb) {_x000D_
this.evtMap[evt].push(cb);_x000D_
}_x000D_
_x000D_
off(evt, lcb) {_x000D_
this.evtMap[evt] = this.evtMap[evt].filter(cb => cb !== lcb);_x000D_
}_x000D_
_x000D_
trigger(evt, data) {_x000D_
this.evtMap[evt].map(handler => handler(data));_x000D_
}_x000D_
_x000D_
handleTouchStart(evt) {_x000D_
this.xDown = evt.touches[0].clientX;_x000D_
this.yDown = evt.touches[0].clientY;_x000D_
}_x000D_
_x000D_
handleTouchEnd(evt) {_x000D_
const deltaX = evt.changedTouches[0].clientX - this.xDown;_x000D_
const deltaY = evt.changedTouches[0].clientY - this.yDown;_x000D_
const distMoved = Math.abs(Math.abs(deltaX) > Math.abs(deltaY) ? deltaX : deltaY);_x000D_
const activePct = distMoved / this.element.offsetWidth;_x000D_
_x000D_
if (activePct > this.options.triggerPercent) {_x000D_
if (Math.abs(deltaX) > Math.abs(deltaY)) {_x000D_
deltaX < 0 ? this.trigger('SWIPE_LEFT') : this.trigger('SWIPE_RIGHT');_x000D_
} else {_x000D_
deltaY > 0 ? this.trigger('SWIPE_UP') : this.trigger('SWIPE_DOWN');_x000D_
}_x000D_
}_x000D_
}_x000D_
}_x000D_
_x000D_
export default SwipeEventDispatcher;
_x000D_