Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "evt", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Type safe replacement for node's EventEmitter", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -22,3 +22,3 @@ | ||
`'evt'` is intended to be a replacement for Node's `'events'` and a lighter alternative to `'rxjs'`. | ||
`'evt'` is intended to be a replacement for Node's `'events'` and a lighter alternative to `'rxjs'`. | ||
It enable and encourage **functional programming** and makes heavy use of **typescript**'s type inference features to provide **type safety** while keeping things **concise and elegant** 🍸. | ||
@@ -32,3 +32,3 @@ | ||
# TLDR; | ||
# TLDR*; | ||
@@ -65,2 +65,4 @@ ```typescript | ||
_*Those are introductory examples, EVT can do much more than this._ | ||
# Try it | ||
@@ -73,20 +75,19 @@ | ||
<p align="center"> | ||
<b><a href="https://stackblitz.com/edit/ts-evt-demo-hello-world?embed=1&file=index.ts">Run hello world</a></b> | ||
<b><a href="https://stackblitz.com/edit/evt-playground?embed=1&file=index.ts&hideExplorer=1">Run some examples</a></b> | ||
</p> | ||
## Motivation | ||
# Motivation | ||
There are a lot of things that can't easily be done with `EventEmitter`: | ||
* Enforcing type safety. | ||
* Enforcing type safety. | ||
* Removing a particular listener when 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. | ||
* 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._ | ||
_Example: waiting at most one second for the next message, stop waiting if the socket disconnects._ | ||
RxJS have its issues as well: | ||
* When chaining operators the type is often lost along the way as TypeScript struggle to keep track of the mutation / filtering being applied to the event flow. | ||
* Introduce _\(too\)_ many abstractions/operators, combining them right can be challenging, even for seemingly straights forward control flows. | ||
* When chaining operators the type is often lost along the way as TypeScript struggle to keep track of the mutation / filtering being applied to the event flow. | ||
* Introduce _\(too\)_ many abstractions/operators, combining them right can be challenging, even for seemingly straights forward control flows. | ||
@@ -93,0 +94,0 @@ EVT is an attempt to solve all these issues while trying to remain as accessible as `EventEmitter`. |
450892
101