ts-eventemitter
A thin TypeScript wrapper for EventEmitter which provides with type-safety.
Install
npm install ts-eventemitter
Usage
- Define your EventEmitter.
; ; ;
- Use it.
; MyEventEmitter.event'foo'.onconsole.log'foo'.event'bar'.onconsole.log`Hello, `.event'baz'.onconsole.log`Hello, . Your id is `; MyEventEmitter.event'foo'.emit;MyEventEmitter.event'bar'.emit'kimamula';MyEventEmitter.event'baz'.emit; // The below codes raise compilation errorsMyEventEmitter.event'fo'.emit; // typoMyEventEmitter.event'bar'.on; // wrong argument typeMyEventEmitter.event'baz'.emit1; // wrong argument type