emit-ts
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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 });

Package Sidebar

Install

npm i emit-ts

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

7.01 kB

Total Files

7

Last publish

Collaborators

  • bacra