-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.mustache
76 lines (53 loc) · 2.26 KB
/
README.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
[![Build Status](https://travis-ci.org/reactgular/observables.svg?branch=master)](https://travis-ci.org/reactgular/observables)
[![Coverage Status](https://coveralls.io/repos/github/reactgular/observables/badge.svg?branch=master)](https://coveralls.io/github/reactgular/observables?branch=master)
[![npm version](https://badge.fury.io/js/%40reactgular%2Fobservables.svg)](https://badge.fury.io/js/%40reactgular%2Fobservables)
## What is Observables?
Observables is a small Rxjs 6 library that contains handy operators and utilities.
## Why use this rxjs library?
This library contains operators and utilities that solve some very common problems that I face with Rxjs. Here is
a quick list of features that I use most often in projects.
- [ifOp()](#ifop) apply operators based upon conditions.
- [windowResize()](#windowresize) creates a debounced observable of window size changes.
- [withSwitchMap()](#withswitchmap) and [withMergeMap()](#withmergemap) but emits the outer and inner values.
- [enabledWhen()](#enabledwhen) and [disabledWhen()](#disabledwhen) toggle the flow of values.
- [loadFirst()](#loadfirst) emits a state object for HTTP requests.
- [switchChain()](#switchchain) links together multiple [switchMap()](https://rxjs.dev/api/operators/switchMap) operators.
## Installation
To get started, install the package from npm.
```bash
npm install @reactgular/observables
```
This package requires the Rxjs 6 as a peer dependency.
```bash
npm install rxjs
```
## Usage
Operators and utilities are imported from the package path `@reactgular/observables`.
For example;
```typescript
import {Observable} from 'rxjs';
import {windowResize, distinctStringify} from '@reactgular/observables';
function conditionalResize(cond$: Observable<boolean>): Observable<{}> {
return windowResize(250).pipe(
enabledWhen(cond$)
);
}
```
{{#sections}}
# {{name}}
{{description}}
Operators | Operators | Operators | Operators | Operators | Operators
----------|-----------|-----------|-----------|-----------|-----------
{{#toc}}
{{#row}}[{{name}}](#{{id}}){{#separator}} | {{/separator}}{{/row}}
{{/toc}}
{{/sections}}
{{#sections}}
## {{name}} List
{{#features}}
### {{name}}
{{{content}}}
[[source]({{{url}}})] [[tests]({{{test}}})] [[up](#{{up}})]
----
{{/features}}
{{/sections}}