JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" ondblclick="whateverFunc()" onmousedown="func()" onmouseup="revert()" value="hold for long"/>

JavaScript

var timer;
var istrue = false;
var delay = 3000; // how much long u have to hold click in MS
function func()
{
   istrue = true;
   timer = setTimeout(function(){ makeChange();},delay);
}

function makeChange()
{
      if(timer)
      clearTimeout(timer);
      
      if(istrue)
      {
            /// rest of your code
          alert('holding');

      }
}
function revert()
{
   istrue =false;
}
function whateverFunc()
{
    alert('dblclick');
}