An open API service indexing awesome lists of open source software.

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: 8 months ago
JSON representation

multiScan operator for RxJS - Combine multiple sources into a single scan operation.

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);
```