Type safe replacement for node's EventEmitter
npm install evt
💧EventEmitter's typesafe replacement💧
'evt' is intended to be a replacement for 'events'.
tsafe, run-exclusive and minimal-polyfills are all from the same author as EVT).
typescript
import { Evt } from "https://deno.land/x/evt/mod.ts";
`
Anywhere else:
`bash
$ npm install --save evt
`
`typescript
import { Evt } from "evt";
`
Try it
Motivations
There are a lot of things that can't easily be done with EventEmitter:
* Enforcing type safety.
* Removing a particular listener ( if the callback is an anonymous function ).
* Adding a one-time listener for the next event that meets a condition.
* Waiting \(via a Promise\) for one thing or another to happen.
_Example: waiting at most one second for the next message, stop waiting if the socket disconnects._
Why would someone pick EVT over RxJS:
* EVT's learning curve is not as steep as RxJS's.
* Generates code that is easier to grasp for people not familiar with reactive programming.
EVT is an attempt to address all these points while trying to remain as accessible as EventEmitter`.