# message-taker

> [![codecov](https://codecov.io/gh/satoruk/message-taker/branch/master/graph/badge.svg)](https://codecov.io/gh/satoruk/message-taker) ![Test Badge] ![Lint Badge]

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

## Install

```sh
npm install message-taker
pnpm add message-taker
yarn add message-taker
bun add message-taker
```

## 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 | 2020-08-08 |
| First published | 2020-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | satoruk |
| Keywords | async, typescript |

## Links

- npm: https://www.npmjs.com/package/message-taker
- Homepage: https://github.com/satoruk/message-taker
- npm.io page: https://npm.io/package/message-taker

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-08-08
- 1.0.0 — 2020-07-26

## README

# message-taker

[![codecov](https://codecov.io/gh/satoruk/message-taker/branch/master/graph/badge.svg)](https://codecov.io/gh/satoruk/message-taker)
![Test Badge]
![Lint Badge]

## Install

```shell
$ yarn add message-taker
```

## Usage

```ts
import { useMessageTaker, onTimeout } from "message-taker";

const sample = async () => {
  const [notify, take] = useMessageTaker<string>();

  const unsubscribe1 = onTimeout(() => notify("A"), 20);
  const unsubscribe2 = onTimeout(() => notify("B"), 10);

  console.log(await take()); // => "B"
  console.log(await take()); // => "A"

  [
    unsubscribe1, //
    unsubscribe2,
  ].forEach((unsubscribe) => unsubscribe());
};
sample();
```

[test badge]: https://github.com/satoruk/message-taker/workflows/Test/badge.svg
[lint badge]: https://github.com/satoruk/message-taker/workflows/Lint%20Code%20Base/badge.svg

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