# @utsubo/events

> react library for custom events. Based on eventemitter3

Latest version **0.1.7** (published 2022-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @utsubo/events
pnpm add @utsubo/events
yarn add @utsubo/events
bun add @utsubo/events
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2022-11-15 |
| First published | 2021-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Renaud Rohlinger |
| Maintainers | cbennett-utsubo, onirenaud |
| Keywords | react, events |

## Links

- npm: https://www.npmjs.com/package/@utsubo/events
- Repository: https://github.com/utsuboco/events
- Homepage: https://github.com/utsuboco/events#readme
- Issues: https://github.com/utsuboco/events/issues
- npm.io page: https://npm.io/package/@utsubo/events

## Dependencies (1)

- [eventemitter3](https://npm.io/package/eventemitter3.md) ^4.0.7

## 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

- 0.1.7 (latest) — 2022-11-15
- 0.1.6 — 2022-09-17
- 0.1.5 — 2022-09-17
- 0.1.4 — 2022-09-17
- 0.1.3 — 2022-09-17
- 0.1.2 — 2021-11-18
- 0.1.1 — 2021-09-16
- 0.1.0 — 2021-09-16
- 0.0.2 — 2021-09-16
- 0.0.1 — 2021-09-16

## README

# @utsubo/events

Minimalist library to emit and receive custom events.

```bash
yarn add @utsubo/events
```

## Example

```ts
import { onEvent, offEvent, emitEvent, useEvent } from '@utsubo/events'

// Create an event listener
const handler = (e) => console.log('event', e)
onEvent('event', handler, { once: false })

// Dispatch a payload to event listeners
emitEvent('event', 'event data')

// Remove the event listener
offEvent('event', handler, { once: false })

// React hook bindings to create reactive handlers.
function Component() {
  useEvent('event', (e) => console.log('event', e), [key], { once: false })
}
```

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