@universal-packages/event-emitter
v1.1.5
Published
Event emitter 2 with universal convention
Downloads
50,753
Readme
Buffer Dispatcher
It extends EventEmitter2
Install
npm install @universal-packages/event-emitter
EventEmitter
It behaves exactly as EventEmitter2 but with wildcards enabled by default and following events convention for universal-packages.
import { EventEmitter } from '@universal-packages/event-emitter'
import { startMEasurement } from '@universal-packages/time-measurer'
const measurer = startMeasurement()
const emitter = new EventEmitter()
emitter.on('event', (event) => {
console.log(event)
})
emitter.emit('event', { message: 'Hello World', measurement: measurer.finish(), payload: { foo: 'bar'} })
emitter.emit('error', { error: new Error('Something went wrong'), measurement: measurer.finish(), payload: { foo: 'bar'} })
Typescript
This library is developed in TypeScript and shipped fully typed.
Contributing
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.