react-easy-swipe
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -19,2 +19,3 @@ (function (global, factory) { | ||
}); | ||
exports.setHasSupportToCaptureOption = setHasSupportToCaptureOption; | ||
@@ -79,2 +80,19 @@ var _react2 = _interopRequireDefault(_react); | ||
var supportsCaptureOption = false; | ||
function setHasSupportToCaptureOption(hasSupport) { | ||
supportsCaptureOption = hasSupport; | ||
} | ||
try { | ||
addEventListener("test", null, Object.defineProperty({}, 'capture', { get: function get() { | ||
setHasSupportToCaptureOption(true); | ||
} })); | ||
} catch (e) {} | ||
function getSafeEventHandlerOpts() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { capture: true }; | ||
return supportsCaptureOption ? options : options.capture; | ||
} | ||
/** | ||
@@ -125,2 +143,22 @@ * [getPosition returns a position element that works for mouse or touch events] | ||
_createClass(ReactSwipe, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
if (this.swiper) { | ||
this.swiper.addEventListener('touchmove', this._handleSwipeMove, getSafeEventHandlerOpts({ | ||
capture: true, | ||
passive: false | ||
})); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
if (this.swiper) { | ||
this.swiper.removeEventListener('touchmove', this._handleSwipeMove, getSafeEventHandlerOpts({ | ||
capture: true, | ||
passive: false | ||
})); | ||
} | ||
} | ||
}, { | ||
key: '_onMouseDown', | ||
@@ -217,7 +255,11 @@ value: function _onMouseDown(event) { | ||
value: function render() { | ||
var _this2 = this; | ||
return _react2.default.createElement( | ||
this.props.tagName, | ||
{ | ||
ref: function ref(node) { | ||
return _this2.swiper = node; | ||
}, | ||
onMouseDown: this._onMouseDown, | ||
onTouchMove: this._handleSwipeMove, | ||
onTouchStart: this._handleSwipeStart, | ||
@@ -224,0 +266,0 @@ onTouchEnd: this._handleSwipeEnd, |
{ | ||
"name": "react-easy-swipe", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "React easy swipe - Easy handler for common touch operations", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
186390
420