Gathering detailed insights and metrics for touchsweep
Gathering detailed insights and metrics for touchsweep
Gathering detailed insights and metrics for touchsweep
Gathering detailed insights and metrics for touchsweep
npm install touchsweep
Typescript
Module System
Node Version
NPM Version
Use passive event listeners for better web vitals
Updated on Oct 17, 2023
Add move detection
Updated on Nov 16, 2022
Use Rollup to build
Updated on Nov 01, 2022
Migrate to TypeScript
Updated on Sep 30, 2022
Mouse support
Updated on Mar 02, 2022
TypeScript definitions
Updated on Apr 20, 2021
TypeScript (84.4%)
JavaScript (15.6%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
10 Stars
734 Commits
6 Forks
2 Watchers
1 Branches
4 Contributors
Updated on Jul 05, 2025
Latest Version
2.2.0
Package Id
touchsweep@2.2.0
Unpacked Size
49.02 kB
Size
12.63 kB
File Count
7
NPM Version
10.1.0
Node Version
20.8.0
Published on
Oct 17, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Super tiny vanilla JS module to detect swipe direction and trigger custom events accordingly.
1npm i touchsweep
or
1yarn add touchsweep
1import TouchSweep from 'touchsweep'; 2 3const area = document.getElementById('swipe-area'); 4const data = { 5 value: 1 6}; 7const touchThreshold = 20; 8 9const touchSweepInstance = new TouchSweep(area, data, touchThreshold); 10 11// Then listen for custom swipe events and do your magic: 12 13area.addEventListener('swipeleft', event => { 14 // You have swiped left 15 // Custom event data is located in `event.detail` 16 // Details about coordinates are also available under `event.detail` 17}); 18 19area.addEventListener('swiperight', event => { 20 // You have swiped right 21 // Custom event data is located in `event.detail` 22 // Details about coordinates are also available under `event.detail` 23}); 24 25area.addEventListener('swipedown', event => { 26 // You have swiped down 27 // Custom event data is located in `event.detail` 28 // Details about coordinates are also available under `event.detail` 29}); 30 31area.addEventListener('swipeup', event => { 32 // You have swiped up 33 // Custom event data is located in `event.detail` 34 // Details about coordinates are also available under `event.detail` 35}); 36 37area.addEventListener('swipemove', event => { 38 // You are swiped continuously 39 // Custom event data is located in `event.detail` 40 // Details about coordinates are also available under `event.detail` 41}); 42 43area.addEventListener('tap', event => { 44 // You have tapped 45 // Custom event data is located in `event.detail` 46 // Details about coordinates are also available under `event.detail` 47});
The module constructor accepts three (3) arguments:
element
: A HTML Element. Default is document.body
eventData
: A plain JS object. Default is {}
threshold
: How many pixels to count until an event is fired. Default is 40TouchSweep provides a minimal API for you to use.
The TouchSweep
instance exposes two public methods which allow you to add or to remove all event listeners responsible for the module functionality.
This is useful in cases where you want to remove the TouchSweep
container/area from the DOM and prevent possible memory leaks by removing all event listeners related to this DOM element.
In order to remove all previously attached event listeners:
1touchSweepInstance.unbind();
In order to add all previously removed event listeners:
1touchSweepInstance.bind();
Currently all evergreen browsers are supported.
There is a simple demo illustrating how the TouchSweep library works.
Check the code here and the live demo here
TouchSweep
is written in Typescript and provides full Typescript support out of the box.
MIT
No vulnerabilities found.
Reason
13 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
1 existing vulnerabilities detected
Details
Reason
Found 0/29 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More