# smart-swipe-controller

> Helps trigger events on swipe

Latest version **0.1.3** (published 2023-07-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install smart-swipe-controller
pnpm add smart-swipe-controller
yarn add smart-swipe-controller
bun add smart-swipe-controller
```

## 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.1.3 |
| Published | 2023-07-21 |
| First published | 2023-07-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | GaronCode |
| Maintainers | garoncode |
| Keywords | swipe, simple, standalone, easy, import |

## Links

- npm: https://www.npmjs.com/package/smart-swipe-controller
- Repository: https://github.com/GaronCode/smart-swipe-controller
- Homepage: https://github.com/GaronCode/smart-swipe-controller#readme
- Issues: https://github.com/GaronCode/smart-swipe-controller/issues
- npm.io page: https://npm.io/package/smart-swipe-controller

## 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

- 0.1.3 (latest) — 2023-07-21
- 0.1.2 — 2023-07-19
- 0.1.1 — 2023-07-19
- 0.1.0 — 2023-07-19

## README

# smart-swipe-controller
Lib simple add additional tap events in `HTML element`
additional events:
- **swipeLeft** - swipe from right to left
- **swipeRight** - swipe from left to right
- **swipeUp** - swipe from bottom to top
- **swipeDown** - swipe from top to bottom
- **tap** - one tap

## Usage
### VIA NPM
1. `npm install smart-swipe-controller`
2. Import controller to your project
   ```js
    import { SmartSwipeController } from "smart-swipe-controller";
   ```
3. Add it to HTML element
   ```js
    new SmartSwipeController(HTML_Element);
   ```

### Classic import method
Include **SmartSwipeController** and add additional events to `HTML element` like this
- If you want include as a module
    Copy file from [this](https://github.com/GaronCode/smart-swipe-controller/blob/master/dist/smartSwipeController.esm.js) (or [minify version](https://github.com/GaronCode/smart-swipe-controller/blob/master/dist/smartSwipeController.esm.mini.js))  to your project folder
    ```html
    <script type="module">
    import { SmartSwipeController } from "./smartSwipeController.esm.js";
    new SmartSwipeController(HTML_Element, 30)
    </script>
    ```
 - If you want include as *iife-style* (you need use global object `SSC`)
    Copy file from [this](https://github.com/GaronCode/smart-swipe-controller/blob/master/dist/smartSwipeController.iife.js) (or [minify version](https://github.com/GaronCode/smart-swipe-controller/blob/master/dist/smartSwipeController.iife.mini.js))  to your project folder
    ```html
    <script src="smartSwipeController.iife.js"></script>
    <script>
    new SSC.SmartSwipeController(HTML_Element, 30);
    </script>
    ```


### Subscribe to additional events
   ```js
    HTML_Element.addEventListener("swipeleft", () => {
        ...
    });

    HTML_Element.addEventListener("swiperight", () => {
        ...
    });

    HTML_Element.addEventListener("swipeup", () => {
        ...
    });

    HTML_Element.addEventListener("swipedown", () => {
        ...
    });

    HTML_Element.addEventListener("tap", () => {
        ...
    });
   ```

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