Eyas / RamzLib

Reactive Library for TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RamzLib

Reactive Library for TypeScript

Provides reactive constructs such as Observable to Node and browser code via TypeScript.

Using Observables

The basic building block of RamzLib is the Observable<T> type. This provides a functional API on top of repeatable asynchronous events. If you're unfamiliar with the Observable concept, then Observable<T> is to T[] as Promise<T> is to T itself.

// `timeout` is an example static helper from Observable;
// counter will have a monotonically increasing number Observed every second
const counter: Observable<number> = Observable.timeout(1000);

counter.forEach(n => console.log(n + " seconds passed."));
counter.map(n => n * 1000).forEach(n => console.log(n + " milliseconds passed."));

// observable can be used to process expensive data that we
// receive asynchronously, without waiting for the rest:
function processAsync(observable: Observable<number>): Observable<string> {
  return observable.reduce("", expensiveOp);
}

Building

This project requires: NodeJS and npm. Now you can manage the rest of the dependencies through npm (these are located in package.json):

npm install

Now you are ready to build and run tests:

npm run build

will produce output to built/.

npm run test

will run tests in Jest.

About

Reactive Library for TypeScript

License:MIT License


Languages

Language:TypeScript 100.0%