# eventemitter-strict

> A eventemitter with typescript full support

Latest version **1.0.1** (published 2022-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install eventemitter-strict
pnpm add eventemitter-strict
yarn add eventemitter-strict
bun add eventemitter-strict
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-06-08 |
| First published | 2022-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | moonrailgun |
| Maintainers | moonrailgun |
| Keywords | EventEmitter, EventEmitter2, EventEmitter3, Events, addEventListener, addListener, on, off, emit, emits, emitter, event, once, pubsub, pub/sub, publish, reactor, subscribe |

## Links

- npm: https://www.npmjs.com/package/eventemitter-strict
- Repository: https://github.com/moonrailgun/eventemitter-strict
- Homepage: https://github.com/moonrailgun/eventemitter-strict#readme
- Issues: https://github.com/moonrailgun/eventemitter-strict/issues
- npm.io page: https://npm.io/package/eventemitter-strict

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-06-08
- 1.0.0 — 2022-06-08

## README

# eventemitter-strict

A eventemitter with typescript full support

`eventemitter-strict` is a eventemitter with typescript full support. The module is API compatible with the EventEmitter that ships by default with Node.js.

Allow to type safe definition your eventemitter

## Feature

- typesafe
- compatible with nodejs
- simple but strong

## Install

```bash
npm install eventemitter-strict
```

## Usage

```typescript
import { EventEmitter } from 'eventemitter-strict';

interface FooEventMap {
  eventA: () => void;
  eventB: (num: number) => void;
}

const ee = new EventEmitter<FooEventMap>();
ee.emit('eventA');
ee.emit('eventB', 1);
ee.emit('eventB', "Any"); // this will throw error in ts
```

or use with extends

```typescript
import { EventEmitter } from 'eventemitter-strict';

interface FooEventMap {
  eventA: () => void;
  eventB: (num: number) => void;
}

class Foo extends EventEmitter<FooEventMap> {
  bar() {
    this.emit('eventA');
    this.emit('eventB', 1);
    this.emit('eventB', "Any"); // this will throw error in ts
  }
}
```

## License

[MIT](./LICENSE)

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