Simple module to detect if a mouse button is pressed or not.
Watch mouse events on element
(defaults to window
).
Passing preventDefault
as true
will disable mouse actions on the element
in question – including right clicks, which is sometimes useful for games.
true
or false
, depending whether the left mouse button is pressed down.
true
or false
, depending whether the right mouse button is pressed down.
true
or false
, depending whether the middle mouse button is pressed down.
Emitted with the original mouse event
every time a mouse button is pressed.
Emitted with the original mouse event
every time a mouse button is released.
To be called when this instance is no longer required: removes all of the attached event listeners.
MIT. See LICENSE.md for details.