Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mouse-change

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mouse-change

Mouse state change listener

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
181K
decreased by-1.62%
Maintainers
1
Weekly downloads
 
Created
Source

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

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 element
  • onchange(buttons,x,y,mods) is an optional callback which gets called every time that the mouse state changes inside element
    • buttons is the state of the mouse buttons
    • x is the x coordinate of the mouse
    • y is the y coordinate of the mouse
    • mods is an object storing the state of any key modifiers
      • mods.shift is the state of the shift key
      • mods.alt is the state of then alt key
      • mods.control is the state of the control key
      • mods.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

License

(c) 2015 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 27 Nov 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc