# mouse-change

> Mouse state change listener

Latest version **1.4.0** (published 2016-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install mouse-change
pnpm add mouse-change
yarn add mouse-change
bun add mouse-change
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2016-11-27 |
| First published | 2015-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Mikola Lysenko |
| Maintainers | mikolalysenko |
| Keywords | mouse, state, listen, change, button, click, hold, up, down, over, polyfill, bug, fix |

## Links

- npm: https://www.npmjs.com/package/mouse-change
- Repository: https://github.com/mikolalysenko/mouse-change
- Issues: https://github.com/mikolalysenko/mouse-change/issues
- npm.io page: https://npm.io/package/mouse-change

## Dependencies (1)

- [mouse-event](https://npm.io/package/mouse-event.md) ^1.0.0

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 1.4.0 (latest) — 2016-11-27
- 1.3.0 — 2016-05-02
- 1.2.1 — 2015-06-07
- 1.2.0 — 2015-06-07
- 1.1.1 — 2015-02-17
- 1.1.0 — 2015-02-17
- 1.0.0 — 2015-02-16

## README

mouse-change
============
Listens for any mouse state changes.

# Example

```javascript
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](https://mikolalysenko.github.io/mouse-change)

# 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

---
_Source: https://npm.io/package/mouse-change · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
