JSFiddle - React, Tailwind, and code Playground

by aldomatic

HTML

<button id="buttonTap">Tap me</button>

CSS

body{
 padding:20px;   
}

JavaScript

var fastButton = function(element, handler){
    this.element = element;
    this.handler = handler;
    
    element.addEventListener('touchstart', this, false);
    element.addeventListener('click', this, false);
}
    fastButton.prototype.handleEvent(event){
        switch (event.type) {
        case 'touchstart': this.onTouchStart(event); break;
        case 'touchmove': this.onTouchMove(event); break;
        case 'touchend': this.onClick(event); break;
        case 'click': this.onClick(event); break;
  }