Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

mouse-change

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

10

example/example.js
require('../mouse-listen')(function(buttons, x, y, mods) {
document.body.innerHTML =
'<p>Buttons: 0b' + buttons.toString(2) +
', x:' + x +
', y:' + y +
document.body.innerHTML =
'<p>Buttons: 0b' + buttons.toString(2) +
', x:' + x +
', y:' + y +
', mods:' + JSON.stringify(mods) + '</p>'
})
})

@@ -8,3 +8,2 @@ 'use strict'

function mouseListen(element, callback) {
if(!callback) {

@@ -60,3 +59,3 @@ callback = element

y = nextY||0
callback(buttonState, x, y, mods)
callback && callback(buttonState, x, y, mods)
}

@@ -81,3 +80,3 @@ }

mods.shift = mods.alt = mods.control = mods.meta = false
callback(0, 0, 0, mods)
callback && callback(0, 0, 0, mods)
}

@@ -88,3 +87,3 @@ }

if(updateMods(ev)) {
callback(buttonState, x, y, mods)
callback && callback(buttonState, x, y, mods)
}

@@ -91,0 +90,0 @@ }

{
"name": "mouse-change",
"version": "1.2.1",
"version": "1.3.0",
"description": "Mouse state change listener",

@@ -5,0 +5,0 @@ "main": "mouse-listen.js",

@@ -26,7 +26,7 @@ mouse-change

#### `var l = require('mouse-change')([element,] onchange(buttons,x,y,mods))`
#### `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 called every time that the mouse state changes inside `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

@@ -44,3 +44,3 @@ + `x` is the x coordinate of the mouse

#### `l.enabled`
Toggles whether or not
Toggles whether or not

@@ -47,0 +47,0 @@ #### `l.x`

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