# mt-events

> Make mobile events user-friendly.

Latest version **1.3.0** (published 2018-08-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install mt-events
pnpm add mt-events
yarn add mt-events
bun add mt-events
```

## 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.3.0 |
| Published | 2018-08-27 |
| First published | 2018-07-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ranjayzheng |
| Maintainers | cynxt, jerryonlyzrj, joyfang |
| Keywords | mobile, events |

## Links

- npm: https://www.npmjs.com/package/mt-events
- Repository: https://github.com/jerryOnlyZRJ/mobile-events
- Homepage: https://github.com/jerryOnlyZRJ/mobile-events#readme
- Issues: https://github.com/jerryOnlyZRJ/mobile-events/issues
- npm.io page: https://npm.io/package/mt-events

## 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.3.0 (latest) — 2018-08-27
- 1.2.6 — 2018-08-22
- 1.2.5 — 2018-08-17
- 1.2.4 — 2018-08-17
- 1.2.3 — 2018-08-15
- 1.2.2 — 2018-08-12
- 1.2.1 — 2018-08-12
- 1.2.0 — 2018-08-11
- 1.1.3 — 2018-08-07
- 1.1.1 — 2018-08-06
- 1.1.0 — 2018-08-06
- 1.0.2 — 2018-07-31
- 1.0.1 — 2018-07-31
- 1.0.0 — 2018-07-30

## README

# mt-events
Handle mobile events on the web easily

![Travis (.org)](https://img.shields.io/travis/jerryOnlyZRJ/mobile-events.svg) [![codecov](https://codecov.io/gh/jerryOnlyZRJ/mobile-events/branch/master/graph/badge.svg)](https://codecov.io/gh/jerryOnlyZRJ/mobile-events)  [![npm](https://img.shields.io/npm/v/mt-events.svg)](https://www.npmjs.com/package/mt-events)   [![npm](https://img.shields.io/npm/dw/mt-events.svg)](https://www.npmjs.com/package/mt-events)  ![GitHub](https://img.shields.io/github/license/jerryOnlyZRJ/mobile-events.svg)  ![GitHub language count](https://img.shields.io/badge/language-JavaScript-yellow.svg)

# Preview

You can try it just now by this -> http://mtevents.jerryonlyzrj.com/test.html

## Features

* Supports widely-used mobile terminal events such as double tap and long tap, in addition to native web events like clicking. With mt-events, you could listen for these mobile/web events just the way you would using the native `addEventListener` web API or JQuery.
* Allows for event delegation. All you need to do is adding an extra argument like `$.on` in JQuery.
* The whole library is only 2KB after gzip. We will deploy the script to our CDN as soon as possible.
* Use **WeakMap** to manage the reference of HTMLElement and its event handler, so there is no need for you to remove the event handler after you remove a HTMLElement, the weak reference will be recycled by GC.

## Browser Support

![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |
--- | --- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |

![browser-support](./docs/user/images/browser-support.png)

## Usage

### url

Include the (minified) **mtevents.min.js**  script file in your HTML:

```html
<script src="http://mtevents.jerryonlyzrj.com/mtevents.min.js"></script>
```

Then use the `mtEvents` function directly in your JavaScript code:

```js
mtEvents('#bindTarget', 'click', e => console.log('click'))
```

### npm

The following is an example of using MtEvents like a Node.js module, inside a Vue file for instance.

Install the **mt-events** package with [npm](https://www.npmjs.org/):

```shell
npm i mt-events
```

Require and use it like such:

```html
//test.vue
<script>
const mtEvents = require('mt-events')
export default {
    ...,
    mounted(){
        mtEvents('#bindTarget', 'click', e => console.log('click'))
    }
}
</script>
```

## Tests

This project comes with unit tests. You can run the test with:

```shell
npm t
```

A coverage file is included in the **test** folder.

## Docs

### Users
See the user API documentations below for your reference ⬇️

[中文文档](https://github.com/jerryOnlyZRJ/mobile-events/blob/master/docs/user/docs(zh).md)

[Documentation](https://github.com/jerryOnlyZRJ/mobile-events/blob/master/docs/user/docs(en).md)

### Developers

Run the command below to create the **developer** sub-directory inside the **docs** folder:

```shell
npm run docs
```

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