mouse-change
Listens for any mouse state changes.
Example
require('mouse-change')(function(buttons, x, y) {
document.body.innerHTML =
'<p>Buttons: 0b' + buttons.toString(2) +
', x:' + x +
', y:' + y + '</p>'
})
Try it out in your browser
Install
npm i mouse-change
API
require('mouse-change')([element,] onchange(buttons,x,y,mods))
Listens for any mouse state changes on the given element.
element
is an optional elementonchange(buttons,x,y,mods)
is called every time that the mouse state changes inside element
buttons
is the state of the mouse buttonsx
is the x coordinate of the mousey
is the y coordinate of the mousemods
is an object storing the state of any key modifiers
mods.shift
is the state of the shift keymods.alt
is the state of then alt keymods.control
is the state of the control keymods.meta
is the state of the meta key
License
(c) 2015 Mikola Lysenko. MIT License