Socket
Socket
Sign inDemoInstall

mouse-pressed

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mouse-pressed

Simple module to detect if a mouse button is pressed or not.


Version published
Weekly downloads
13
decreased by-67.5%
Maintainers
1
Install size
46.5 kB
Created
Weekly downloads
 

Readme

Source

mouse-pressed experimental

Simple module to detect if a mouse button is pressed or not.

Usage

NPM

pressed = mousePressed(element, [preventDefault])

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.

pressed.left

true or false, depending whether the left mouse button is pressed down.

pressed.right

true or false, depending whether the right mouse button is pressed down.

pressed.middle

true or false, depending whether the middle mouse button is pressed down.

pressed.on('down', callback(event))

Emitted with the original mouse event every time a mouse button is pressed.

pressed.on('up', callback(event))

Emitted with the original mouse event every time a mouse button is released.

pressed.dispose()

To be called when this instance is no longer required: removes all of the attached event listeners.

License

MIT. See LICENSE.md for details.

Keywords

FAQs

Last updated on 19 Nov 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc