Socket
Socket
Sign inDemoInstall

tocada

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tocada

Touch events with ease! (Inspired by the wonderful Tocca.js library). Written in Typescript with love


Version published
Weekly downloads
11
decreased by-94.95%
Maintainers
1
Install size
25.0 kB
Created
Weekly downloads
 

Readme

Source

Tocada JS

Touch Events with ease

It's dead simple to use

npm install tocada
/**
Add events for
swipe // fired before swipeleft, up, down, right events
swipeup
swiperight
swipedown
swipeleft
gesture // fired before any pinch or spread
pinch
spread
*/

import { useTouchEvents } from "tocada";

const swipeArea = useTouchEvents(querySelector | element);

/**
Remove events
*/
swipeArea.destroy();

detail object

The above CustomEvents emit a detail object with the following data

velocityX,      // speed of x-axis movement
velocityY,      // speed of y-axis movement
velocity,       // speed of overall touch event
avgPressure,    // touch pressure for the entire event
startPressure,  // starting touch pressure for the event
endPressure,    // ending touch pressure for the event
startTime,      // datetime at the start of the event
endTime,        // datetime at the end of the event
distanceX,      // distance traveled over the x-axis
distanceY,      // distance traveled over the y-axis
distance,       // distance traveled in a straight line
startingElement,// first element touched
endingElement,  // last element touched
touchedElements,// all of the element (including duplicates) touched during the event -- convert to a Set to make elements unique: new Set(touchedElements);

Help me out

I write a lot of open source software (some more useful than others). You can help me out by tossing me a few bucks to buy coffee.

Buy Me A Coffee

Keywords

FAQs

Last updated on 21 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc