https://github.com/LayZeeDK/rxjs-multi-scan
multiScan operator for RxJS - Combine multiple sources into a single scan operation.
https://github.com/LayZeeDK/rxjs-multi-scan
operator rxjs rxjs6
Last synced: 11 months ago
JSON representation
multiScan operator for RxJS - Combine multiple sources into a single scan operation.
- Host: GitHub
- URL: https://github.com/LayZeeDK/rxjs-multi-scan
- Owner: LayZeeDK
- License: mit
- Created: 2018-07-23T00:13:12.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2018-10-25T18:02:00.000Z (over 7 years ago)
- Last Synced: 2024-11-20T17:52:00.067Z (over 1 year ago)
- Topics: operator, rxjs, rxjs6
- Language: TypeScript
- Homepage:
- Size: 110 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `multiScan` operator for RxJS
## rxjs-multi-scan
A combination operator that combines multiple sources of scan operations.
## Installation
Install using NPM CLI
```
npm install --save rxjs-multi-scan
```
or using Yarn CLI
```
yarn add rxjs-multi-scan
```
## Use cases
Create a reactive state container that reacts to multiple observables with a
simple, easy-to-read syntax. Each source is combined with a reducer function to
reduce the current state and the emitted value to a new state.
## Usage
```typescript
import { Observable, Subject } from 'rxjs';
import { multiScan } from 'rxjs-multi-scan';
const initialCount: number = 0;
const add: Subject = new Subject();
const subtract: Subject = new Subject();
const count: Observable = multiScan(
add, (count, addend) => count + addend,
subtract, (count, subtrahend) => count - subtrahend,
initialCount);
```