0.2.15 • Published 5 years ago

forceify v0.2.15

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Forceify

Simple, yet powerful touch-force handler

Features

  • Lightweight
  • Blazing fast
  • No dependecies
  • Active tweening
  • 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

$ npm install forceify
# or
$ yarn add forceify

CDN

# 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

const myElement = document.querySelector("#myElement");
const forceTouchInstance = new Forceify(myElement);
forceTouchInstance.onForce(({ force }) => {
  console.log(force);
});

Methods

NameTypeDescription
onFunctionaddEventListener alternative
isIOS3DTouchFunctionreturns support of real 3D Touch
isChromeFunctionreturns true if Chrome browser/OS
isIOSFunctionreturns true if iOS devices
isMouseFunctionreturns true if it's mouse-powered device

Compatibility

It's compatible with any ES6 supported browser

License

MIT

0.2.15

5 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.5

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago