# @livelybone/mouse-events

> Some complex mouse events, such as dragMove event with deltaX/deltaY relative to mousedown/touchstart, mouse wheel with good compatibility ...

Latest version **1.0.0** (published 2020-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @livelybone/mouse-events
pnpm add @livelybone/mouse-events
yarn add @livelybone/mouse-events
bun add @livelybone/mouse-events
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-05-16 |
| First published | 2019-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 31.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | 2631541504@qq.com |
| Maintainers | livelybone |
| Keywords | mouse event, touch event, dragmove, mouse wheel |

## Links

- npm: https://www.npmjs.com/package/@livelybone/mouse-events
- Repository: https://github.com/livelybone/mouse-events
- Homepage: https://github.com/livelybone/mouse-events#readme
- Issues: https://github.com/livelybone/mouse-events/issues
- npm.io page: https://npm.io/package/@livelybone/mouse-events

## Dependencies (2)

- [is-mobile](https://npm.io/package/is-mobile.md) ^2.0.1
- [@livelybone/mouse-wheel](https://npm.io/package/@livelybone/mouse-wheel.md) ^4.2.1

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-05-16
- 1.0.0-beta — 2019-07-30
- 0.1.0 — 2019-07-21
- 0.0.1 — 2019-07-21

## README

# @livelybone/mouse-events
[![NPM Version](http://img.shields.io/npm/v/@livelybone/mouse-events.svg?style=flat-square)](https://www.npmjs.com/package/@livelybone/mouse-events)
[![Download Month](http://img.shields.io/npm/dm/@livelybone/mouse-events.svg?style=flat-square)](https://www.npmjs.com/package/@livelybone/mouse-events)
![gzip with dependencies: kb](https://img.shields.io/badge/gzip--with--dependencies-kb-brightgreen.svg "gzip with dependencies: kb")
![typescript](https://img.shields.io/badge/typescript-supported-blue.svg "typescript")
![pkg.module](https://img.shields.io/badge/pkg.module-supported-blue.svg "pkg.module")

> `pkg.module supported`, which means that you can apply tree-shaking in you project

[中文文档](./README-CN.md)

Some complex mouse events, such as dragMove event with deltaX/deltaY relative to mousedown/touchstart, mouse wheel with good compatibility ...

## repository
https://github.com/livelybone/mouse-events.git

## Demo
https://github.com/livelybone/mouse-events#readme

## Run Example
you can see the usage by run the example of the module, here is the step:

1. Clone the library `git clone https://github.com/livelybone/mouse-events.git`
2. Go to the directory `cd your-module-directory`
3. Install npm dependencies `npm i`(use taobao registry: `npm i --registry=http://registry.npm.taobao.org`)
4. Open service `npm run dev`
5. See the example(usually is `http://127.0.0.1:3000/examples/test.html`) in your browser

## Installation
```bash
npm i -S @livelybone/mouse-events
```

## Global name - The variable the module exported in `umd` bundle
`MouseEvents`

## Interface
See what method or params you can use in [index.d.ts](./index.d.ts)

## Usage
```typescript
import { DragMove, Utils, MouseWheel, DragMoveEvent } from '@livelybone/mouse-events'

const el = document.getElementById('el')
let removeListener

removeListener = MouseWheel.bind(el, (ev: MouseWheel.CustomWheelEvent) => {
  // ...
})
removeListener()

removeListener = DragMove.bind(el, (ev: DragMoveEvent) => {
  // ...
})
removeListener()

console.log(Utils.$isMobile)
removeListener = Utils.$addListener(el, 'scroll', ev => {
  // ...
})
removeListener()
```

## CDN
Use in html, see what you can use in [CDN: unpkg](https://unpkg.com/@livelybone/mouse-events/lib/umd/)
```html
<-- use what you want -->
<script src="https://unpkg.com/@livelybone/mouse-events/lib/umd/<--module-->.js"></script>
```

Or，see what you can use in [CDN: jsdelivr](https://cdn.jsdelivr.net/npm/@livelybone/mouse-events/lib/umd/)
```html
<script src="https://cdn.jsdelivr.net/npm/@livelybone/mouse-events/lib/umd/<--module-->.js"></script>
```

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