# tiny-signal

> Minimal 228 byte implementation of the observer design pattern.

Latest version **1.0.0** (published 2019-12-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiny-signal
pnpm add tiny-signal
yarn add tiny-signal
bun add tiny-signal
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-12-02 |
| First published | 2018-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Mike Wagz |
| Maintainers | wagz |
| Keywords | signal, signals, event, events, observer, emitter |

## Links

- npm: https://www.npmjs.com/package/tiny-signal
- Repository: https://github.com/mikehwagz/tiny-signal
- Issues: https://github.com/mikehwagz/tiny-signal/issues
- npm.io page: https://npm.io/package/tiny-signal

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

- 1.0.0 (latest) — 2019-12-02
- 0.0.6 — 2018-12-14
- 0.0.5 — 2018-12-14
- 0.0.4 — 2018-12-14
- 0.0.3 — 2018-12-14
- 0.0.2 — 2018-12-14
- 0.0.1 — 2018-12-14

## README

# tiny-signal

tiny-signal is a minimal implementation of the observer design pattern in only 228 bytes gzipped.

## Installation

```
npm i tiny-signal
```

## Usage

```js
import signal from 'tiny-signal'

const instance = signal()

const foo = data => console.log(`foo! ${data}`)
const bar = data => console.log(`bar! ${data}`)
const baz = data => console.log(`baz! ${data}`)

instance.add(foo)
instance.add(bar)
instance.add(baz)

instance.dispatch('hello world!')
// foo! hello world!
// bar! hello world!
// baz! hello world!

instance.remove(bar)
instance.dispatch('howdy!')
// foo! howdy!
// baz! howdy!

instance.destroy() // removes all listeners
```

## License

[MIT License](https://opensource.org/licenses/MIT) © [Mike Wagz](https://wagz.io)

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