Popularity
4.0
Growing
Activity
7.7
Growing
445
6
6

Description

'evt' is intended to be a replacement for 'events'. It enables and encourages functional programming and makes heavy use of typescript's type inference features to provide type safety while keeping things concise and elegant 🍸. Suitable for any JS runtime env (deno, node, old browser, react-native ...) ✅ It is both a Deno and an NPM module. ✅ Lightweight, no dependency. ✅ No polyfills needed, the NPM module is transpiled down to ES3. ✅ React Hooks integration Can be imported in TypeScript projects using version >= 3.4 (Mar 2019) and in any plain JS projects.

Monthly Downloads: 0
Programming language: TypeScript
License: MIT License
Tags: React     Events     Event     Reactive Programming     Rxjs    
Latest version: v1.10.2

EVT alternatives and similar libraries

Based on the "Utilities" category.
Alternatively, view EVT alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of EVT or a related project?

Add another 'Utilities' Library

README

💧EventEmitter's typesafe replacement💧

Home - Documentation


'evt' is intended to be a replacement for 'events'.
It enables and encourages functional programming and makes heavy use of typescript's type inference features to provide type safety while keeping things concise and elegant 🍸.

Suitable for any JS runtime env (deno, node, old browsers, react-native ...)

Can be imported in TypeScript projects using version TypeScript >= 3.8 (February 20th, 2020) and in any plain JS projects.

NOTE: There is very few breaking changes from v1 to v2. Check them out.

Who is using it

Install / Import

In Deno:

import { Evt } from "https://deno.land/x/evt/mod.ts";

Anywhere else:

$ npm install --save evt
import { Evt } from "evt"; 

Try it


Playground

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.

Get Started

The sticker


Shop


*Note that all licence references and agreements mentioned in the EVT README section above are relevant to that project's source code only.