JSFiddle - React, Tailwind, and code Playground

by levchenko_d

HTML

<div id="test">
azazazazazazaz
</div>

JavaScript

Element.prototype.onlongclick = function(fn){
	var t = this,
  		timer;
  
  t.addEventListener('mousedown', function(e){
  	timer = setTimeout(function(){
    	fn(e);
    }, 500)
  });
  t.addEventListener('mouseup', function(){
  	clearTimeout(timer);
  });
};

document.getElementById('test').onlongclick(function(){
  alert('yoooo');
});