🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-fastclick

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-fastclick - npm Package Compare versions

Comparing version

to
1.0.1

.travis.yml

64

index.js

@@ -20,2 +20,18 @@ 'use strict';

var addListener = function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback, false);
}
};
var removeListener = function (target, eventType, callback) {
if (target.removeEventListener) {
target.removeEventListener(eventType, callback, false);
} else if (target.detachEvent) {
target.detachEvent('on' + eventType, callback, false);
}
};
// Create new listen method

@@ -31,9 +47,4 @@ EventListener.listen = function (target, eventType, callback) {

// Remove touch listeners
if (window.removeEventListener) {
window.removeEventListener(constants.touchend, onTouchEnd);
window.removeEventListener(constants.touchmove, onTouchMove);
} else if (window.detachEvent) {
window.detachEvent('on' + constants.touchend, onTouchEnd);
window.detachEvent('on' + constants.touchmove, onTouchMove);
}
removeListener(window, constants.touchend, onTouchEnd);
removeListener(window, constants.touchmove, onTouchMove);

@@ -72,9 +83,4 @@ if (!moved) {

// Add touch listeners
if (window.addEventListener) {
window.addEventListener(constants.touchend, onTouchEnd);
window.addEventListener(constants.touchmove, onTouchMove);
} else if (window.attachEvent) {
window.attachEvent('on' + constants.touchend, onTouchEnd);
window.attachEvent('on' + constants.touchmove, onTouchMove);
}
addListener(window, constants.touchend, onTouchEnd);
addListener(window, constants.touchmove, onTouchMove);
};

@@ -91,23 +97,13 @@

// Get original click listener remove function
var originalListener = listen(target, eventType, onClick);
var removeOriginalListener = listen(target, eventType, onClick);
if (target.addEventListener) {
target.addEventListener(constants.touchstart, onTouchStart, false);
return {
remove: function () {
// Remove oriringal click listeners
originalListener();
target.removeEventListener(constants.touchstart, onTouchStart, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + constants.touchstart, onTouchStart);
return {
remove: function () {
// Remove oriringal click listeners
originalListener();
target.detachEvent('on' + constants.touchstart, onTouchStart);
}
};
}
addListener(target, constants.touchstart, onTouchStart);
// Return remove listener functions
return {
remove: function () {
removeOriginalListener();
removeListener(target, constants.touchstart, onTouchStart);
}
};
} else {

@@ -114,0 +110,0 @@ return listen(target, eventType, callback);

{
"name": "react-fastclick",
"version": "1.0.0",
"version": "1.0.1",
"description": "Fast Touch Events for React",

@@ -15,2 +15,3 @@ "main": "index.js",

"react",
"fastclick",
"fast",

@@ -20,2 +21,3 @@ "click",

"events",
"event",
"mobile"

@@ -22,0 +24,0 @@ ],

@@ -47,6 +47,13 @@ # React Fastclick

2. On some devices the elements flicker after being touched. This can be prevented by calling `event.preventDefault()`.
2. On some devices the elements flicker after being touched. This can be prevented by setting the css property `-webkit-tap-highlight-color` to transparent.
Either target `html, body` (to prevent the flickering on all elements) or target the specific element you don't want to flicker e.g. `button`.
```css
html, body {
-webkit-tap-highlight-color: transparent;
}
```
## Support
Current only tested with React 0.13.3
Currently only tested with React 0.13.3