https://github.com/dgeibi/event-emitter
a functional event emitter
https://github.com/dgeibi/event-emitter
eventemitter
Last synced: 2 months 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T03:48:39.000Z (over 7 years ago)
- Last Synced: 2025-04-18T11:32:52.284Z (3 months ago)
- Topics: eventemitter
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- 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');
})();
```