Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dgeibi/event-emitter
a functional event emitter
https://github.com/dgeibi/event-emitter
eventemitter
Last synced: 1 day ago
JSON representation
a functional event emitter
- Host: GitHub
- URL: https://github.com/dgeibi/event-emitter
- Owner: dgeibi
- License: mit
- Created: 2017-06-29T02:45:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T03:48:39.000Z (about 7 years ago)
- Last Synced: 2024-10-30T00:36:31.715Z (about 2 months ago)
- Topics: eventemitter
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# uemitter
- API like [Node's EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
- support `emitAsync`
- methods don't rely on `this`## Install
```
$ npm install uemitter
```## Usage
``` js
import Emitter from 'uemitter';
// or // const Emitter = require('uemitter');const emitter = Emitter();
// listen to an event
emitter.once('foo', async () => {
const data = await fetch('example.com/foo.json').then(res => res.json());
// do something with data
});(async () => {
// emit an event
await emitter.emitAsync('foo');
})();
```