Skip to content

Commit 4cc517b

Browse files
authored
v1.3.1 (#41)
* Update changelog * 1.3.1 * Add 1.3.1 to changelog * Update unpkg link
1 parent 734cd9f commit 4cc517b

File tree

4 files changed

+48
-35
lines changed

4 files changed

+48
-35
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
### 1.3.1
4+
5+
- Repo improvements, package upgrades
6+
7+
### 1.3.0
8+
9+
- Allow `preventScroll` to be a function ([#33](https://github.com/umanghome/swipe-listener/pull/33))
10+
11+
### 1.2.0
12+
13+
- Added e.target to the details object for the dispatched event ([#28](https://github.com/umanghome/swipe-listener/pull/28))
14+
315
### 1.1.0
416

517
- `main` in `package.json` refers to `dist/swipe-listener.min.js` instead of `index.js`. Transpiled version would be served directly.

README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Swipe-Listener
2+
23
[![npm version](https://badge.fury.io/js/swipe-listener.svg)](https://www.npmjs.com/package/swipe-listener)
34

45
Zero-dependency, minimal swipe-gesture listener for the web.
@@ -73,7 +74,7 @@ container.addEventListener('swipe', function (e) {
7374
</script>
7475
```
7576

76-
Swipe-listener is also available from unpkg: [`https://unpkg.com/swipe-listener@1.2.0/dist/swipe-listener.min.js`](https://unpkg.com/swipe-listener@1.2.0/dist/swipe-listener.min.js)
77+
Swipe-listener is also available from unpkg: [`https://unpkg.com/swipe-listener@1.3.1/dist/swipe-listener.min.js`](https://unpkg.com/swipe-listener@1.3.1/dist/swipe-listener.min.js)
7778

7879
## Installing using NPM
7980

@@ -113,16 +114,16 @@ Data passed to `event.detail`:
113114

114115
### Options
115116

116-
| Key | Description | Default value |
117-
| --- | --- | --- |
118-
| `minHorizontal` | Minimum number of horizontal pixels travelled for the gesture to be considered as a left or right swipe. | `10` |
119-
| `minVertical` | Minimum number of vertical pixels travelled for the gesture to be considered as a top or bottom swipe. | `10` |
120-
| `deltaHorizontal` | Maximum difference between the rightmost pixel (right-swipe) or the leftmost pixel (left-swipe) travelled to and the pixel at which the gesture is released. | `3` |
121-
| `deltaVertical` | Maximum difference between the bottommost pixel (bottom-swipe) or the topmost pixel (top-swipe) travelled to and the pixel at which the gesture is released. | `5` |
122-
| `preventScroll` | Prevents page scrolling when swiping on the DOM element. Can also be specified as a function with the signature `(event) => boolean` | `false` |
123-
| `lockAxis` | Enforces only one direction to be true instead of multiple. Selects the direction with the most travel. Is not enforced when the travel is equal. Example: for a top-left swipe, only one of `top` and `left` will be `true` instead of both. | `true` |
124-
| `touch` | Whether to listen for swipes with touch events | `true` |
125-
| `mouse` | Whether to listen for swipes with mouse events | `true` |
117+
| Key | Description | Default value |
118+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
119+
| `minHorizontal` | Minimum number of horizontal pixels travelled for the gesture to be considered as a left or right swipe. | `10` |
120+
| `minVertical` | Minimum number of vertical pixels travelled for the gesture to be considered as a top or bottom swipe. | `10` |
121+
| `deltaHorizontal` | Maximum difference between the rightmost pixel (right-swipe) or the leftmost pixel (left-swipe) travelled to and the pixel at which the gesture is released. | `3` |
122+
| `deltaVertical` | Maximum difference between the bottommost pixel (bottom-swipe) or the topmost pixel (top-swipe) travelled to and the pixel at which the gesture is released. | `5` |
123+
| `preventScroll` | Prevents page scrolling when swiping on the DOM element. Can also be specified as a function with the signature `(event) => boolean` | `false` |
124+
| `lockAxis` | Enforces only one direction to be true instead of multiple. Selects the direction with the most travel. Is not enforced when the travel is equal. Example: for a top-left swipe, only one of `top` and `left` will be `true` instead of both. | `true` |
125+
| `touch` | Whether to listen for swipes with touch events | `true` |
126+
| `mouse` | Whether to listen for swipes with mouse events | `true` |
126127

127128
### `.off()`
128129

@@ -143,48 +144,48 @@ Emitted once a swipe is completed.
143144

144145
`event.detail` contains
145146

146-
| key | type | description |
147-
| --- | --- | --- |
148-
| `directions` | Object | Object containing `top`, `left`, `bottom`, `right` keys. The directions in which the swipe is performed are set to `true`. |
149-
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
150-
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
151-
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
147+
| key | type | description |
148+
| ------------ | ------- | -------------------------------------------------------------------------------------------------------------------------- |
149+
| `directions` | Object | Object containing `top`, `left`, `bottom`, `right` keys. The directions in which the swipe is performed are set to `true`. |
150+
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
151+
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
152+
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
152153

153154
### `swiping` - Emitted while a swipe is being performed.
154155

155156
Emitted multiple times during a single swipe.
156157

157158
`event.detail` contains
158159

159-
| key | type | description |
160-
| --- | --- | --- |
161-
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
162-
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
163-
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
160+
| key | type | description |
161+
| ------- | ------- | -------------------------------------------------------------------------- |
162+
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
163+
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
164+
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
164165

165166
### `swiperelease` - Emitted once the swipe is released/completed.
166167

167168
Emitted at the end of the swipe.
168169

169170
`event.detail` contains
170171

171-
| key | type | description |
172-
| --- | --- | --- |
173-
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
174-
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
175-
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
172+
| key | type | description |
173+
| ------- | ------- | -------------------------------------------------------------------------- |
174+
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
175+
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
176+
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
176177

177178
### `swipecancel` - Emitted if the swipe-distance did not meet minimum travel-distance.
178179

179180
Emitted at the end of the swipe.
180181

181182
`event.detail` contains
182183

183-
| key | type | description |
184-
| --- | --- | --- |
185-
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
186-
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
187-
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
184+
| key | type | description |
185+
| ------- | ------- | -------------------------------------------------------------------------- |
186+
| `x` | Array | Array of two items: the starting x-coordinate and the ending x-coordinate. |
187+
| `y` | Array | Array of two items: the starting y-coordinate and the ending y-coordinate. |
188+
| `touch` | Boolean | Whether or not `TouchEvent` was used for this particular event. |
188189

189190
# Misc
190191

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swipe-listener",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Zero-dependency, minimal swipe-gesture listener for the web.",
55
"main": "dist/swipe-listener.min.js",
66
"scripts": {

0 commit comments

Comments
 (0)