Getting Started

contact.js is a open-source library that can recognize gestures made by touch, pen and mouse using PointerEvents.
Installation
Method 1: Javascript module
... and reference the downloaded file:
<script src="/path/to/contact.js" type="module"></script>
Method 2: Install it using npm
npm install contactjs@latest
Usage
First, initialize a PointerListener instance. This will active gesture detection on the domElement of your choice.
const domElement = document.getElementById("idOfElement");
const pointerListener = new PointerListener(domElement, options);
domElement.addEventListener("tap", function(event){
	// do something on tap
});
By default, all recognizers are active and their events are fired accordingly.
Also the viewport meta tag is recommended to scale the screen correctly. You do not have to add user-scalable=no or maximum-scale=1. Default browser gestures (pinch to zoom) can be prevented by adding touch-action:none to the domElement in css.
<meta name="viewport" content="width=device-width, initial-scale=1">
One PointerListener to rule them all
If you initialize PointerListener with document.body as the domElement, you will be able to access contactjs events on all elements.
const pointerListener = new PointerListener(document.body, options);
const anyDomElement = document.getElementById("idOfElement")
anyDomElement.addEventListener("tap", function(event){
	// do something on tap
});