wheel-indicator
Advanced tools
Comparing version 1.2.1 to 1.2.2
/** | ||
* Generates event when user makes new movement (like a swipe on a touchscreen). | ||
* @version 1.2.0 | ||
* @version 1.2.2 | ||
* @link https://github.com/Promo/wheel-indicator | ||
@@ -206,3 +206,3 @@ * @license MIT | ||
if(elem.addEventListener) { | ||
elem.addEventListener(type, handler, false); | ||
elem.addEventListener(type, handler, isPassiveSupported() ? { passive: false } : false); | ||
} else if (elem.attachEvent) { | ||
@@ -215,3 +215,3 @@ elem.attachEvent('on' + type, handler); | ||
if (elem.removeEventListener) { | ||
elem.removeEventListener(type, handler, false); | ||
elem.removeEventListener(type, handler, isPassiveSupported() ? { passive: false } : false); | ||
} else if (elem.detachEvent) { | ||
@@ -247,1 +247,19 @@ elem.detachEvent('on'+ type, handler); | ||
} | ||
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support | ||
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Improving_scrolling_performance_with_passive_listeners | ||
function isPassiveSupported() { | ||
var passiveSupported = false; | ||
try { | ||
var options = Object.defineProperty({}, "passive", { | ||
get: function() { | ||
passiveSupported = true; | ||
} | ||
}); | ||
window.addEventListener("test", null, options); | ||
window.removeEventListener("test", null, options); | ||
} catch(err) {} | ||
return passiveSupported; | ||
} |
{ | ||
"name": "wheel-indicator", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "normalizes an inertial mousewheel", | ||
@@ -5,0 +5,0 @@ "main": "lib/wheel-indicator", |
26185
527