0.1.2 • Published 7 years ago
whenable v0.1.2
whenable
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)
});