Sha256: 1604a0aa64cb29a5f811995e5a97f77494fb86515c476c2f4481965876ff7f6d
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
import Swipe from './swipe'; class Touch { constructor(element, event = 'swipe', options = {}) { this._element = element; this._event = event; // events this.swipe = new Swipe(element, options); // handlers this._touchStartHandler = this._handleTouchStart.bind(this); this._touchMoveHandler = this._handleTouchMove.bind(this); this._touchEndHandler = this._handleTouchEnd.bind(this); } dispose() { this._element.removeEventListener('touchstart', this._touchStartHandler); this._element.removeEventListener('touchmove', this._touchMoveHandler); window.removeEventListener('touchend', this._touchEndHandler); } init() { // istanbul ignore next this._element.addEventListener('touchstart', (e) => this._handleTouchStart(e)); // istanbul ignore next this._element.addEventListener('touchmove', (e) => this._handleTouchMove(e)); // istanbul ignore next window.addEventListener('touchend', (e) => this._handleTouchEnd(e)); } _handleTouchStart(e) { this[this._event].handleTouchStart(e); } _handleTouchMove(e) { this[this._event].handleTouchMove(e); } _handleTouchEnd(e) { this[this._event].handleTouchEnd(e); } } export default Touch;
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-rubin-collab-theme-0.1.1 | _third_party/mdb-ui-kit/src/js/mdb/util/touch/index.js |