Gathering detailed insights and metrics for touchsweep
Gathering detailed insights and metrics for touchsweep
npm install touchsweep
Typescript
Module System
Node Version
NPM Version
72.4
Supply Chain
99.3
Quality
75.9
Maintenance
100
Vulnerability
100
License
Use passive event listeners for better web vitals
Published on 17 Oct 2023
Add move detection
Published on 16 Nov 2022
Use Rollup to build
Published on 01 Nov 2022
Migrate to TypeScript
Published on 30 Sept 2022
Mouse support
Published on 02 Mar 2022
TypeScript definitions
Published on 20 Apr 2021
TypeScript (84.4%)
JavaScript (15.6%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
132,765
Last Day
92
Last Week
564
Last Month
2,339
Last Year
35,171
10 Stars
713 Commits
6 Forks
3 Watching
1 Branches
4 Contributors
Minified
Minified + Gzipped
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
Publised On
17 Oct 2023
Cumulative downloads
Total Downloads
Last day
37.3%
92
Compared to previous day
Last week
17%
564
Compared to previous week
Last month
-18.1%
2,339
Compared to previous month
Last year
4.4%
35,171
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
no binaries found in the repo
Reason
18 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
SAST tool is not run on all commits -- score normalized to 1
Details
Reason
Found 0/27 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
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-02-03
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