项目作者: darrylhodgins

项目描述 :
Observable Math
高级语言: TypeScript
项目地址: git://github.com/darrylhodgins/rx-math.git
创建时间: 2017-07-29T01:14:03Z
项目社区:https://github.com/darrylhodgins/rx-math

开源协议:

下载


Reactive Math

Dependencies Status
devDependency Status
npm
GitHub license
Build Status

Helpers to write functional reactive calculators.

Installation

  1. npm install --save rx-math

Basic Usage

This is an oversimplification of how one would actually use RxMath. In reality, the source Observables will come from a form input, data service, or perhaps even another RxMath calculation. It’s likely that you’ll also want to create a class to encapsulate a more complex calculation.

  1. let x: Observable<number> = Observable.of(123);
  2. let y: Observable<number> = Observable.of(456);
  3. let average: Observable<number> = RxMath.average(x, y);
  4. average.subscribe((val: number) => {
  5. console.log('Average is', val);
  6. });
  7. // outputs "Average is 289.5"