Gathering detailed insights and metrics for propagating-hammerjs
Gathering detailed insights and metrics for propagating-hammerjs
Gathering detailed insights and metrics for propagating-hammerjs
Gathering detailed insights and metrics for propagating-hammerjs
Extend hammer.js with event propagation
npm install propagating-hammerjs
Typescript
Module System
Node Version
NPM Version
99.7
Supply Chain
100
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
38,117,253
Last Day
12,568
Last Week
426,904
Last Month
1,897,075
Last Year
17,595,465
MIT License
40 Stars
51 Commits
14 Forks
3 Watchers
1 Branches
3 Contributors
Updated on Sep 25, 2024
Minified
Minified + Gzipped
Latest Version
3.0.0
Package Id
propagating-hammerjs@3.0.0
Unpacked Size
29.00 kB
Size
6.90 kB
File Count
10
NPM Version
9.8.0
Node Version
20.5.0
Published on
Jan 25, 2024
Cumulative downloads
Total Downloads
Last Day
-13.9%
12,568
Compared to previous day
Last Week
-12.3%
426,904
Compared to previous week
Last Month
5.6%
1,897,075
Compared to previous month
Last Year
148.7%
17,595,465
Compared to previous year
1
2
Extend hammer.js (v2) with event propagation.
We use the @egjs/hammerjs fork because hammer.js is not maintained anymore.
event.stopPropagation()
to stop
propagation to parent elements.event.firstTarget
containing the
element where a gesture started.1npm install @egjs/hammerjs propagating-hammerjs
1<!DOCTYPE html> 2<html> 3<head> 4 <script src="https://unpkg.com/@egjs/hammerjs@latest/dist/hammer.js"></script> 5 <script src="https://unpkg.com/propagating-hammerjs@latest/propagating.js"></script> 6 <script> 7 function init() { 8 var hammer = propagating(new Hammer(element)); 9 } 10 </script> 11</head> 12<body> 13</body> 14</html>
1var Hammer = require('@egjs/hammerjs'); 2var propagating = require('propagating-hammerjs'); 3 4function init() { 5 var hammer = propagating(new Hammer(element)); 6}
1import Hammer from '@egjs/hammerjs'; 2import propagating from 'propagating-hammerjs'; 3 4function init() { 5 const hammer = propagating(new Hammer(element)); 6}
To extend individual hammer.js instances with event propagation:
1var hammer = propagating(new Hammer(element));
To extend the global hammer.js constructor
1Hammer = propagating(Hammer);
Here a basic usage example. More examples are available in the folder /examples.
1<!DOCTYPE html> 2<html> 3<head> 4 <script src="node_modules/@egjs/hammerjs/dist/hammer.js"></script> 5 <script src="node_muludes/propagating-hammerjs/propagating.js"></script> 6 <style> 7 div {border: 1px solid black;} 8 #parent {width: 400px; height: 400px; background: lightgreen;} 9 #child {width: 200px; height: 200px; background: yellow; margin: 10px;} 10 </style> 11</head> 12<body> 13 14<div id="parent"> 15 parent 16 <div id="child"> 17 child 18 </div> 19</div> 20 21<script> 22 var parent = document.getElementById('parent'); 23 var hammer1 = propagating(new Hammer(parent)) 24 .on('tap', function (event) { 25 alert('tap on parent'); 26 }); 27 28 var child = document.getElementById('child'); 29 var hammer2 = propagating(new Hammer(child)) 30 .on('tap', function (event) { 31 alert('tap on child'); 32 33 // stop propagation from child to parent 34 event.stopPropagation(); 35 }); 36</script> 37</body> 38</html>
Construction:
1propagating(hammer: Hammer.Manager, options?: { 2 preventDefault?: true | 'mouse' | 'touch' | 'pen' 3}): Hammer.Manager
hammer: Hammer.Manager
An hammer instance or the global hammer constructor.
options: Object
An optional object with options. Available options:
preventDefault: true | 'mouse' | 'touch' | 'pen'
. Optional.
Enforce preventing the default browser behavior. Cannot be set to false
.Returns the same hammer instance with extended functionality.
The emitted hammer.js events are extended with:
event.stopPropagation()
If called, the event will not further propagate the elements parents.
event.firstTarget
Contains the HTML element where a gesture started (where as event.target
contains the element where the pointer is right now).
To generate the UMD bundle for commonjs and browser, run:
1npm run build
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 5/22 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
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