# event-stream-pubsub

> pubsub pattern for in-memory, stateless event streaming

Latest version **0.1.5** (published 2024-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install event-stream-pubsub
pnpm add event-stream-pubsub
yarn add event-stream-pubsub
bun add event-stream-pubsub
```

## Health

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

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

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2024-09-21 |
| First published | 2019-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Author | ehmpathy |
| Maintainers | uladkasach |
| Keywords | event, stream, pub, publish, sub, subscribe, pubsub, event stream, consume |

## Links

- npm: https://www.npmjs.com/package/event-stream-pubsub
- Repository: https://github.com/ehmpathy/event-stream-pubsub
- Issues: https://github.com/ehmpathy/event-stream-pubsub/issues
- npm.io page: https://npm.io/package/event-stream-pubsub

## Dependencies (1)

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

## 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.1.5 (latest) — 2024-09-21
- 0.1.4 — 2024-09-21
- 0.1.3 — 2023-07-18
- 0.1.1 — 2023-07-18
- 0.1.0 — 2019-08-20

## README

# event-stream-pubsub

A simple wrapper around the EventEmitter, allowing us to speak in a pub/sub terms.

Supports in-memory, stateless event streaming out of the box.

## installation

```
npm install --save event-stream-pubsub
```

## usage

```ts
// define your event data-type
interface PhotoSelectedEvent {
  source: string;
  photo: {
    width: number;
    height: number;
    uri: string;
  };
}

// instantiate this particular stream
const photoSelectedEventStream = new EventStreamPubSub<PhotoSelectedEvent>();

// add a subscriber
const consumer = (event: PhotoSelectedEvent) => console.log(event);
photoSelectedEventStream.subscribe({ consumer });

// publish to the stream
const exampleEvent = {
  source: 'CAMERA_ROLL',
  photo: {
    width: 1000,
    height: 1000,
    uri: 'file://...',
  },
};
photoSelectedEventStream.publish(exampleEvent);
```

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