# @dalisoft/swipe-gesture

> Swipe gesture library

Latest version **0.0.6** (published 2019-05-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dalisoft/swipe-gesture
pnpm add @dalisoft/swipe-gesture
yarn add @dalisoft/swipe-gesture
bun add @dalisoft/swipe-gesture
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2019-05-12 |
| First published | 2019-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | dalisoft |
| Maintainers | dalisoft |
| Keywords | swipe-gesture, simple, lightweight, performant |

## Links

- npm: https://www.npmjs.com/package/@dalisoft/swipe-gesture
- Repository: https://github.com/dalisoft/swipe-gesture
- Homepage: https://github.com/dalisoft/swipe-gesture#readme
- Issues: https://github.com/dalisoft/swipe-gesture/issues
- npm.io page: https://npm.io/package/@dalisoft/swipe-gesture

## Recent versions

- 0.0.6 (latest) — 2019-05-12
- 0.0.5 — 2019-05-12
- 0.0.4 — 2019-05-12
- 0.0.3 — 2019-05-12
- 0.0.2 — 2019-05-12
- 0.0.1 — 2019-05-12

## README

# swipe-gesture

[![Greenkeeper badge](https://badges.greenkeeper.io/dalisoft/swipe-gesture.svg)](https://greenkeeper.io/)

Swipe gesture library

**Note**: _This library focused to performance and simplicity. For complex usecase (like long-tap or pinch), please use other library_

## Features

- No limit: not only for DOM
- Handles types for your
- Clean code
- Simple & Easy
- Performant
- UMD compatible

## Demos

- [Simple demo](https://codepen.io/dalisoft/pen/vwKrpw)

## Installation

We recommend install via `npm` because of it's cache and flat node modules tree

```bash
npm i @dalisoft/swipe-gesture
```

then you able to import to Node.js/Browser easily

```js
// Node.js
const SwipeGesture = require("@dalisoft/swipe-gesture");

// Browser
// window.SwipeGesture OR SwipeGesture

// ES6
import SwipeGesture from "@dalisoft/swipe-gesture";
```

## Parameters

- _onPointerDown_ `function(e: Event)` - Call like `pointerdown`
- _onPointerMove_ `function(e: Event)` - Call like `pointermove`
- _onPointerUp_ `function()` - Call like `pointerup`, but without `Event` for performance reason
- _onPanX_ `function(e: Event.X.Delta)` - Call when panning horizontal
- _onPanY_ `function(e: Event.Y.Delta)` - Call when panning vertical
- _onSwipeLeft_ `function(e: Event.X.Delta)` - Call when swipe left
- _onSwipeRight_ `function(e: Event.X.Delta)` - Call when swipe right
- _onSwipeUp_ `function(e: Event.Y.Delta)` - Call when swipe up
- _onSwipeDown_ `function(e: Event.Y.Delta)` - Call when swipe down

## Usage

```js
const swipe = SwipeGesture({
  onPanX: delta => console.log("pan x delta", delta)
});

yourDom.addEventListener("pointerdown", swipe.onStart);
yourDom.addEventListener("pointermove", swipe.onMove);
yourDom.addEventListener("pointerup", swipe.onEnd);
```

## License

MIT

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