# ag-swipe-core

> A lightweight library to detect swipes on touchscreen devices.

Latest version **1.0.2** (published 2022-06-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install ag-swipe-core
pnpm add ag-swipe-core
yarn add ag-swipe-core
bun add ag-swipe-core
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-06-28 |
| First published | 2022-06-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexander Goncharuk |
| Maintainers | agoncharuks |
| Keywords | swipe, gesture, touch, touchscreen, library |

## Links

- npm: https://www.npmjs.com/package/ag-swipe-core
- Homepage: https://github.com/aGoncharuks/ag-swipe
- npm.io page: https://npm.io/package/ag-swipe-core

## Dependencies (1)

- [rxjs](https://npm.io/package/rxjs.md) ^7.5.5

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-06-28
- 1.0.1 — 2022-06-23
- 1.0.0 — 2022-06-23

## README

For more details on the public interface of the library please see the [Github page](https://github.com/aGoncharuks/ag-swipe).

## Installation

```
npm install ag-swipe-core --save
```

## Usage

```typescript
import { createSwipeSubscription, SwipeEvent } from 'ag-swipe-core';

const domElement: HTMLElement = document.querySelector('#swipe-element');

const swipeSubscription = createSwipeSubscription({
  domElement,
  onSwipeEnd: (event: SwipeEvent) => {
    console.log(`SwipeEnd direction: ${event.direction} and distance: ${event.distance}`);
  },
});
```

## Unsubscribing 
When swipe events should no longer be tracked:

```typescript
if (swipeSubscription) {
  swipeSubscription.unsubscribe();
}
```

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