Skip to content
A tidy alternative to EventEmitter.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Eventual is a compositional alternative to EventEmitter.

In contrast with EventEmitter, Eventual removes the need to inherit or wrap an EventEmitter and instead handles events at the variable or property level.


NPM: npm install --save @reasonink/eventual

Yarn: yarn add @reasonink/eventual

How it works

Create an Eventual instance using the eventual() factory function.

let loaded = eventual();

Add handlers with on(callback) or once(callback).

loaded.on(e => console.log(`Data loaded: ${}`));

Fire the event with fire(event).{ data: "the data" });

Callbacks can be removed with off().

function myHandler() {
    // Do something


// ...;

Type safety

Eventual is built with (but doesn't require) TypeScript. Event types can be specified as a type argument to eventual<T>(). Callbacks will expect the given type as their only argument.


interface DataEvent {
    data: string;

let loaded = eventual<DataEvent>();
loaded.on((e: DataEvent) => {
    // Do something with e
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.