JS Mouse Event

const status =  new Proxy({ upDown: '', click: '', move: false }, {
	set(target, key, value) {
		target[key] = value
		render()
		return true
	}
})
const timer = { click: null, move: null }
const render = () => $('#status').html(JSON.stringify(status, null, 4))
window.onmousedown = () => {
	status.upDown = 'Down'
}
window.onmouseup = () => {
	status.upDown = 'Up'
}
window.onclick = () => {
	status.click = 'Click'
	clearTimeout(timer.click)
	timer.click = setTimeout(() => { status.click = '' }, 500)
}
window.ondblclick = () => {
	status.click = 'Double click'
	clearTimeout(timer.click)
	timer.click = setTimeout(() => { status.click = '' }, 500)
}
window.onmousemove = () => {
	status.move = true
	clearTimeout(timer.move)
	timer.move = setTimeout(() => { status.move = false }, 500)
}
render()