What is this repository?
It seems like that
hammer.js repository is no more activated.
But our library (egjs) has deep dependency to hammer.js for touch interaction. And some pending issues were critical for us to make more light size, compatible with node.js , resolve module crash on umd envrioment.
So we solved following issues that are not resolved in original hammer.js
- Support for hammer.js in node.js
- Support ES Module for Tree Shaking
- Change the priority of define and exports for umd
- Polymer/shadow-dom compatibility
We would maintain this repository to fix remain bugs and enhance it until original repository activates.
npm install --save @egjs/hammerjs
yarn add @egjs/hammerjs
We did not provide CDN yet. leave the link to original hammerjs as is.
hammer.js has a quick start option for gestures it already recognizes.
// Get a reference to an element.var square = document;// Create an instance of Hammer with the reference.var hammer = square;// Subscribe to a quick start event: press, tap, or doubletap.// For a full list of quick start events, read the documentation.hammer;
If you want to recognize your own gestures, such as
tripletap, then you'll have to use these steps:
// Get a reference to an element.var square = document;// Create a manager to manage the element.var manager = square;// Create a recognizer.var TripleTap =event: 'tripletap'taps: 3;// Add the recognizer to the manager.manager;// Subscribe to the event.manager;
For further information regarding hammer.js, please read our documentation.
Feel encouraged to report issues or submit pull requests. When you're ready to do either, read our contribution guidelines. If you're looking for another form of contribution, we love help answering questions on our slack channel.