# @ionaru/typed-events

> A tiny module for type-safe events.

Latest version **1.0.0** (published 2022-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ionaru/typed-events
pnpm add @ionaru/typed-events
yarn add @ionaru/typed-events
bun add @ionaru/typed-events
```

Provides the command `typed-events`.

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-05-03 |
| First published | 2019-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jeroen Akkerman |
| Maintainers | ionaru |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2022-05-03
- 1.0.1-2.0 (next) — 2022-05-03
- 0.0.2-1.0 — 2022-05-03
- 0.0.2-7.0 — 2019-02-25
- 0.0.2-6.0 — 2019-02-08
- 0.0.2-5.0 — 2019-02-06
- 0.0.2-4.0 — 2019-02-05
- 0.0.1 — 2019-02-04

## README

# @ionaru/typed-events

[![npm version](https://img.shields.io/npm/v/@ionaru/typed-events.svg?style=for-the-badge)](https://www.npmjs.com/package/@ionaru/typed-events)
[![npm version](https://img.shields.io/npm/v/@ionaru/typed-events/next.svg?style=for-the-badge)](https://www.npmjs.com/package/@ionaru/typed-events/v/next)
[![Build Status](https://img.shields.io/github/workflow/status/ionaru/typed-events/Test%20&%20Deploy/master?style=for-the-badge)](https://github.com/Ionaru/typed-events/actions)

## Description
A tiny package that provides a very simple event system with Typescript support.

## Usage
```
npm install @ionaru/typed-events
```

```ts
import { TypedEvent } from '@ionaru/typed-events';

// Create a new event.
const myEvent = new TypedEvent<string>();

// Create a listener and subscribe to the event.
const listener = (message) => console.log(message);
myEvent.on(listener);

// Emit to notify all listeners.
myEvent.emit('Something happened!')

// console.log: 'Something happened!'
```

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