Mouse state change listener
npm install mouse-changemouse-change
============
Listens for any mouse state changes.
`` Buttons: 0b' + buttons.toString(2) +javascript`
require('mouse-change')(function(buttons, x, y) {
document.body.innerHTML =
'
', x:' + x +
', y:' + y + '
})
``
npm i mouse-change
#### var l = 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 an optional callback which gets called every time that the mouse state changes inside elementbuttons
+ 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 modifiersmods.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
Returns A new listener object which can be used to configure the listener.
#### l.enabled
Toggles whether or not
#### l.x
The x coordinate of the mouse
#### l.y
The y coordinate of the mouse
#### l.buttons
The button state of the mouse
#### l.mods`
The current state of the keyboard modifiers