# @honeo/await-event

> イベントの発生を待つやつ

Latest version **2.0.0** (published 2018-05-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @honeo/await-event
pnpm add @honeo/await-event
yarn add @honeo/await-event
bun add @honeo/await-event
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-05-07 |
| First published | 2016-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | honeo |
| Maintainers | honeo |
| Keywords | eventemitter, eventtarget, await, promise |

## Links

- npm: https://www.npmjs.com/package/@honeo/await-event
- Repository: https://github.com/honeo/await-event
- Homepage: https://github.com/honeo/await-event#readme
- Issues: https://github.com/honeo/await-event/issues
- npm.io page: https://npm.io/package/@honeo/await-event

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

- 2.0.0 (latest) — 2018-05-07
- 1.0.3 — 2016-10-11
- 1.0.2 — 2016-08-08
- 1.0.1 — 2016-08-08
- 1.0.0 — 2016-08-08

## README

# await-event
* [honeo/await-event](https://github.com/honeo/await-event)  
* [@honeo/await-event](https://www.npmjs.com/package/@honeo/await-event)

## なにこれ
Promiseインスタンスを返し、イベントを一度だけ掴んでresolve(event)する。  
ブラウザ拡張機能のAPIでも動く（といいなと思っている）。

## 使い方
```sh
$ npm i @honeo/await-event
```

### Browser (EventTarget)
```js
import AwaitEvent from '@honeo/await-event';

// or Dynamic import, CDN
const AwaitEvent = await import('https://cdn.rawgit.com/honeo/await-event/master/index.mjs').then( (mod)=>{
	return mod.default;
});



(async function(){
	const event = await AwaitEvent(document.body, 'click', false);
	console.log(event.type); // "click"
}());

document.body.click();
```

### Node.js (EventEmitter)
```js
import AwaitEvent from '@honeo/await-event';
import {EventEmitter} from 'events';

const eventemitter = new EventEmitter();

(async function(){
	const event = await AwaitEvent(eventemitter, 'hoge');
	console.log(event.fuga); // "piyo"
}());

eventemitter.emit('hoge', {fuga: 'piyo'});
```

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