# @cadienvan/js-event-bus

> A simple event bus for in-browser usage inspired by Node.js Event Emitter API. Compatible with ESM.

Latest version **0.0.4** (published 2022-10-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cadienvan/js-event-bus
pnpm add @cadienvan/js-event-bus
yarn add @cadienvan/js-event-bus
bun add @cadienvan/js-event-bus
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2022-10-02 |
| First published | 2022-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Michael Di Prisco |
| Maintainers | cadienvan |
| Keywords | event, event bus, bus, js event, event emitter |

## Links

- npm: https://www.npmjs.com/package/@cadienvan/js-event-bus
- Repository: https://github.com/Cadienvan/event-bus
- Homepage: https://github.com/Cadienvan/event-bus#readme
- Issues: https://github.com/Cadienvan/event-bus/issues
- npm.io page: https://npm.io/package/@cadienvan/js-event-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

- 0.0.4 (latest) — 2022-10-02
- 0.0.3 — 2022-10-01
- 0.0.2 — 2022-09-27
- 0.0.1 — 2022-09-27

## README

# What is this?
This is a simple event bus made using the CustomEvent Web API for in-browser usage simulating the Node.js EventEmitter API.

# How do I install it?
You can install it by using the following command:
```bash
npm install @cadienvan/js-event-bus
```

# How to use it?
Simply import the module and start using it as follows:
```js
import ee from '@cadienvan/js-event-bus';
ee.on('event', (data) => console.log(data));
ee.emit('event', 'Hello World!');
ee.off('event');
```

If you prefer a simpler approach, you could just import the `index.js` file in your HTML as a script tag and use the global `eventBus` variable:
```js
eventBus.on('event', (data) => console.log(data));
eventBus.emit('event', 'Hello World!');
eventBus.off('event');
```

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