# @retailwe/common-libs-event

> RetailWe libs

Latest version **0.0.4** (published 2020-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @retailwe/common-libs-event
pnpm add @retailwe/common-libs-event
yarn add @retailwe/common-libs-event
bun add @retailwe/common-libs-event
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2020-09-01 |
| First published | 2020-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.9 |
| Dependencies | 0 |
| Unpacked size | 141.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | gaterking, jeannehuang, jerryc |

## Links

- npm: https://www.npmjs.com/package/@retailwe/common-libs-event
- Repository: git@git.code.tencent.com:tencent-retail-fe/retailwe
- npm.io page: https://npm.io/package/@retailwe/common-libs-event

## Recent versions

- 0.0.4 (latest) — 2020-09-01
- 0.0.2-alpha.0 (beta) — 2020-08-11
- 0.0.3 — 2020-08-13
- 0.0.2 — 2020-08-11

## README

# Event 事件订阅

## 安装

```shell
yarn add '@retailwe/common-libs-event' --save-exact
```

## 使用

```javascript
import Event from '@retailwe/common-libs-event';

const event = new Event();
const callback = (msg) => {...};

// 监听
event.on('event_name', callback);

// 监听一次
event.once('event_name', callback);

// 触发
event.emit('event_name', msg);

// 移除指定事件的特定监听器
event.off('event_name', callback);

// 移除指定事件的所有监听器
event.offAll('event_name');
```

## 单元测试覆盖率

[单元测试覆盖率](cov/index.html)

---
_Source: https://npm.io/package/@retailwe/common-libs-event · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
