JSFiddle - React, Tailwind, and code Playground
by Makha92
HTML
<body>
<div>
Click here
</div>
</body>
CSS
div {
height: 100px;
width: 100px;
background-color: yellow;
text-align: center;
}
JavaScript
var logEvent = (function() {
var count = 1,
timer = 0,
buffer = function () {
clearTimeout(timer)
timer = setTimeout(function () {
count++
}, 30)
}
return function (type, e) {
buffer();
console.log(count + '. ------- ' + type + ' ------')
console.log('type: ' + e.type)
console.log('button: ' + e.button)
console.log('detail: ' + e.detail)
}
})()
window.addEventListener('click', function(e) {
logEvent('CLICK', e)
})
window.addEventListener('contextmenu', function(e) {
logEvent('CONTEXTMENU', e)
})