# swipyjs

> A lightweight JavaScript library for simple touch swipe gesture events

Latest version **0.0.6** (published 2022-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install swipyjs
pnpm add swipyjs
yarn add swipyjs
bun add swipyjs
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2022-09-29 |
| First published | 2018-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | WhiteCube |
| Maintainers | voidgraphics, nyratas |
| Keywords | touch, events, gestures |

## Links

- npm: https://www.npmjs.com/package/swipyjs
- Repository: https://github.com/whiteCube/swipy
- Homepage: https://github.com/whiteCube/swipy#readme
- Issues: https://github.com/whiteCube/swipy/issues
- npm.io page: https://npm.io/package/swipyjs

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2022-09-29
- 0.0.5 — 2018-12-07
- 0.0.4 — 2018-12-07
- 0.0.3 — 2018-12-04
- 0.0.2 — 2018-05-28
- 0.0.1 — 2018-05-28

## README

# Swipy

A lightweight JavaScript library for simple touch swipe gesture events.

## Installation

### NPM

```npm i swipyjs```

### Yarn

```yarn add swipyjs```

## Usage

Define Swipy event listeners by calling `on(event, callback)`:

```javascript
let swipy = new Swipy(document.getElementById('swipy-container'));

swipy.on('swipeleft', function(event, touches) {
    console.log('Swiped to the left!');
});
```

The callback function receives two parameters:

- `event`: the last native `touchmove` event that was triggered.
- `touches`: an object containing the current touch coordinates:

```javascript
{
    down: {x: null, y: null},
    up: {x: null, y: null},
    diff: {x: null, y: null}
}
```

## Methods

### `swipy.on(event, callback)`

Registers a new Swipy event listener.

Available events are:

- `swipetop`
- `swiperight`
- `swipebottom`
- `swipeleft`

### `swipy.bind()`

Adds the native event listeners used by the library.

### `swipy.unbind()`

Removes the native event listeners used by the library.

### `swipy.trigger(listener, event)`

Manually triggers a defined Swipy event.

---
_Source: https://npm.io/package/swipyjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
