# dwj-eventbus

> a eventbus package

Latest version **1.0.2** (published 2022-01-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install dwj-eventbus
pnpm add dwj-eventbus
yarn add dwj-eventbus
bun add dwj-eventbus
```

## 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.2 |
| Published | 2022-01-11 |
| First published | 2022-01-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dengwenjie |
| Maintainers | dengwenj |
| Keywords | dwj, eventbus, dengwj, react, vue |

## Links

- npm: https://www.npmjs.com/package/dwj-eventbus
- Repository: https://github.com/dengwenj/dwj-eventbus
- Homepage: https://github.com/dengwenj
- Issues: https://github.com/dengwenj/dwj-eventbus/issues
- npm.io page: https://npm.io/package/dwj-eventbus

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-01-11
- 1.0.1 — 2022-01-11

## README

## 事件总线 EventBus

## 说明
* 基于 JavaScript 封装的事件总线库，用于 react、vue、小程序等等（在自己能力范围内开发的，可能有有些地方没考虑完全）
* 开发自己的项目可以用自己的 **EventBus**

## npm
```
npm i dwj-eventbus
```
## test
test2 文件：
```js
const DWJEventBus = require('../lib/dengwj')
require('./test1')

DWJEventBus.emit('test1', 'dwj', 'zww') 
DWJEventBus.emit('once', 'adwfwq', 'adqwqqq') 
DWJEventBus.emit('test2', 'qwjkqwkqwqwqwq', 'gwawqwqq') 
DWJEventBus.off('test2')
// DWJEventBus.off(['test1', 'once'])
// DWJEventBus.off('wfww')

console.log(DWJEventBus.eventBus);
```
test1 文件
```js
const DWJEventBus = require('../lib/dengwj')

DWJEventBus.on('test1', (a, b) => {
  console.log(a, b);
})
DWJEventBus.on('test1', (a, b) => {
  console.log(a, b);
})
DWJEventBus.on('test2', (a, b) => {
  console.log(a, b);
})

DWJEventBus.once('once', (a, b) => {
  console.log('once');
  console.log(a, b, '第一个');
})
DWJEventBus.once('once', (a, b) => {
  console.log('once');
  console.log(a, b, '第二个');
})

console.log(DWJEventBus.eventBus);
```

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