npm.io
0.1.155 • Published 1 week ago

@trenskow/async-event-emitter

Licence
BSD-2-Clause
Version
0.1.155
Deps
1
Size
4 kB
Vulns
0
Weekly
0

async-event-emitter

A small library for asynchronous event emitters.

Usage

Below is an example on how to use.

import EventEmitter from '@trenskow/async-event-emitter';

const emitter = new EventEmitter();

emmiter.on('greeting', async (text) => {
	console.info(text);
});

await emitter.emit('greeting', 'Hello, World!');

In the above example Hello, World! will be output to the console.

License

See license in LICENSE

Keywords