JSFiddle - React, Tailwind, and code Playground

by criptkiller

HTML

<div>
    dblclick e click
</div>

CSS

div {
    border: 1px solid darkgray;
    width:100px;
    height:100px;
    background:lightgreen; 
}

JavaScript

timer = 0;
$("div").mousedown(function() {
   // fazer um timer
   // refresca o timer
   var $this = $(this),
       datas = new Date();
       data = $this.data('timer',datas.getTime());
}).mouseup(function() {
    var $this = $(this),
        timer = new Date().getTime(),
        data = $this.data('timer');
    console.debug(data)
    
});