# dynamic-vue-bus

> eventBus with lifecycle in Vue

Latest version **1.0.1** (published 2018-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install dynamic-vue-bus
pnpm add dynamic-vue-bus
yarn add dynamic-vue-bus
bun add dynamic-vue-bus
```

## 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 | 2018-07-12 |
| First published | 2018-07-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Yeyusen |
| Maintainers | ytftianwen |
| Keywords | Vue, EventBus |

## Links

- npm: https://www.npmjs.com/package/dynamic-vue-bus
- Repository: https://github.com/ytftianwen/dynamic-vue-bus
- Homepage: https://github.com/ytftianwen/dynamic-vue-bus#readme
- Issues: https://github.com/ytftianwen/dynamic-vue-bus/issues
- npm.io page: https://npm.io/package/dynamic-vue-bus

## 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.1 (latest) — 2018-07-12
- 1.0.0 — 2018-07-12

## README

在Vue项目中使用EventBus拥有生命周期，不用再去手动销毁
参考文章：[让在Vue中使用的EventBus也有生命周期](https://zhuanlan.zhihu.com/p/39537979)
## 使用
```sh
 npm install dynamic-vue-bus
```

 ```js
 import eventBus from 'dynamic-vue-bus'
 Vue.use(eventBus)
 
```

 
 ## 组件中使用
 ```js
  created () {
    let text = Array(1000000).fill('xxx').join(',')
    this.$eventBus.$on('home-on', (...args) => {
      // todo something
    }, this) // 注意第三个参数要传this
  },
  mounted () {
    setTimeout(() => {
      this.$eventBus.$emit('home-on', '这是home $emit参数')
    }, 1000)
  }
```

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