emit-ts
v1.1.0
Published
Light-weight EventEmitter
Downloads
6
Maintainers
Readme
emit-ts
Install
npm install emit-ts
Usage
import { Emit } from 'emit-ts';
const event = new Emit<{ a: number, b: string }>();
event.on(({ a }) => console.log(a));
event.once(({ b }) => console.log(b));
event.off(() => {});
event.emit({ a: 1, b: '2'});
// typescript check fail
event.on(({ c }) => console.log(c));
event.emit();
event.emit({ a: 1 });