nicksnyder / whenable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

whenable NPM Version travis

A minimal implementation of an object that supports streams of data.

Whenable is similar to:

  • RsJS Observables, except whenable is bare-bones.
  • Promises, except whenable can emit values many times before completing.

Example

import { Whenable } from 'whenable';

const whenable = new Whenable<number>((value, error, complete) => {
    value(1);
    value(2);
    complete();
}).when(value => {
    return (-2 * value).toString();
}).when(value => {
    console.log(value)
});

About


Languages

Language:TypeScript 100.0%