# forceify

> Simple, yet powerful touch-force handler

Latest version **0.2.15** (published 2019-07-29) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.15 |
| Published | 2019-07-29 |
| First published | 2017-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 28.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | dalisoft |
| Maintainers | dalisoft |
| Keywords | 3d, touch, force, force-touch, 3d-touch, ios, js, android, unsupported, simulate, normalize, cross-device, javascript, typescript, lightweight, fast, osx, iphone |

## Links

- npm: https://www.npmjs.com/package/forceify
- npm.io page: https://npm.io/package/forceify

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.15 (latest) — 2019-07-29
- 0.2.14 — 2019-05-09
- 0.2.13 — 2019-05-05
- 0.2.12 — 2019-05-05
- 0.2.11 — 2019-05-05
- 0.2.10 — 2019-05-05
- 0.2.9 — 2019-05-05
- 0.2.8 — 2018-05-22
- 0.2.5 — 2018-05-14
- 0.2.4 — 2018-05-14
- 0.2.3 — 2018-05-14
- 0.2.2 — 2018-05-13
- 0.2.1 — 2018-05-04
- 0.2.0 — 2018-05-03
- 0.1.5 — 2018-03-25
- … 6 more at https://npm.io/package/forceify/versions

## README

# Forceify

Simple, yet powerful touch-**force** handler

## Features

- Lightweight
- Blazing fast
- No dependecies
- Active [tweening](https://mikebolt.github.io/discuss/examples/active_tweens.html)
- Compatible with any mobile/desktop browser
- Handles everything for you
- Clean code
- Performant
- Easy
- UMD compatible

## Note

When your device doesn't support 3D Touch/Force Touch, this library does not force your device work this feature, instead of library polyfills with `pointer` events + tweening (like Instagram post/Telegram app chat)

## Installing

```bash
$ npm install forceify
# or
$ yarn add forceify
```

## CDN

```bash
# unpkg.com
https://unpkg.com/forceify

# npmcdn
https://npmcdn.com/forceify

# jsDelivr
https://cdn.jsdelivr.net/npm/forceify
```

## Usage

It's browser-only mode, so please use it carefully and don't use with NodeJS server-side apps.
You should load script first for working snippet...

### In React

For React apps, please use [React wrapper for Forceify](https://www.npmjs.com/package/react-forceify)

```javascript
const myElement = document.querySelector("#myElement");
const forceTouchInstance = new Forceify(myElement);
forceTouchInstance.onForce(({ force }) => {
  console.log(force);
});
```

## Methods

| Name           | Type       | Description                                 |
| -------------- | ---------- | ------------------------------------------- |
| `on`           | `Function` | `addEventListener` alternative              |
| `isIOS3DTouch` | `Function` | returns support of `real 3D Touch`          |
| `isChrome`     | `Function` | returns `true` if `Chrome` browser/OS       |
| `isIOS`        | `Function` | returns `true` if `iOS` devices             |
| `isMouse`      | `Function` | returns `true` if it's mouse-powered device |

## Compatibility

It's compatible with any ES6 supported browser

## License

MIT

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