# wu-eventemitter

> #### Usage

Latest version **1.0.1** (published 2020-07-09) · 0 weekly downloads

## Install

```sh
npm install wu-eventemitter
pnpm add wu-eventemitter
yarn add wu-eventemitter
bun add wu-eventemitter
```

## 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.0.1 |
| Published | 2020-07-09 |
| First published | 2020-07-09 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 177.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | changshuiwu |

## Links

- npm: https://www.npmjs.com/package/wu-eventemitter
- npm.io page: https://npm.io/package/wu-eventemitter

## Recent versions

- 1.0.1 (latest) — 2020-07-09
- 1.0.0 — 2020-07-09

## README

### 手写一个Eventmitter

#### Usage

```
import  * as event from 'wu-eventemitter'

event.on('click', (...args) => {console.log(args)})
event.on('click', (...args) => {console.log(args)})


event.once('move', (...args) => {console.log(args)})

event.emit('move', 1,2,3)
event.emit('move', 4,5)

event.emit('click', 232)
event.emit('click', 111)
```

#### API

| name      | description                                          | 
| --------- | ---------------------------------------------------- | 
| on(type, cb, flag)        | 事件绑定                                              | 
| once(type, cb, flag)      | 事件绑定，但是只会触发一次                              | 
| emit(type,args)     | 事件触发                                              | 
| eventNames() | 返回所有的事件名                                       | 
| setMaxListeners(num)   | 设置最大可绑定的事件                              | 
| getMaxListeners()      | 返回最多可绑定的事件                                              | 
| addListener(type, cb, flag)      | 事件触发 （同on方法）                                             | 
| removeAllListeners()      | 移除所有绑定事件                                              | 
| removeListener(type)      | 移除绑定事件                                              |

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