uemitter
v0.0.4
Published
a functional event emitter
Downloads
2
Readme
uemitter
- API like Node's EventEmitter
- support
emitAsync
- methods don't rely on
this
Install
$ npm install uemitter
Usage
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');
})();