Skip to content

Commit 698b182

Browse files
authored
Merge pull request #15 from maniator/README
README updates
2 parents fd6940b + fc5e416 commit 698b182

File tree

3 files changed

+100
-69
lines changed

3 files changed

+100
-69
lines changed

README.md

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -49,75 +49,10 @@ NEXT NUMBER: 50 // after a 1 second delay
4949
I AM COMPLETE // same time as previous line
5050
```
5151

52-
### There a few plugins that are available - each return a new Observable instance:
52+
### There a few plugins that are available - each return a new Observable instance
5353

54-
- They are called by doing: `observableInstance$.<pluginFunction>`
54+
- [Documentation on the plugin operators can be seen here](./src/operators/DOCUMENTATION.md)
5555

56-
`.map(<mapCallback>)`
56+
### There are also a few Observables that can be created from the Observable object itself
5757

58-
- will map each value to a new value using the callback
59-
60-
`.filter(<filterCallback>)`
61-
62-
- will filter out values that you do not want to subscribe to
63-
64-
`.do(<doCallback>)`
65-
66-
- will run some callback before passing the current value to the subscription
67-
68-
`.take(<amount>[, <callback>])`
69-
70-
- will take the amount of values you want (or less if it completes first) and then complete -- this is useful for infinitely running observables
71-
- a callback may be passed to filter out the valeus you want to take
72-
73-
`.first([<callback>])`
74-
75-
- this is an alias for `.take(1[, <callback>])`
76-
77-
`.toPromise()`
78-
79-
- this will do a `.first()` on the observable object and return the value from that to the response from a promise
80-
81-
`.flatMap(<mapCallback>)`
82-
83-
- same as `.map(<mapCallback>)` but will take the value of the callback and turn it from an observable to a value
84-
85-
`.switchMap(<mapCallback>)`
86-
87-
- the value from the mapCallback is an observable and if another value comes through the previous observable is cancelled
88-
- this is useful for things like typeaheads where you dont want a request for every keypress
89-
90-
`.delay(<time>)`
91-
92-
- will delay output from the observable until a specific time interval has passed
93-
94-
`.debounceTime(<time>)`
95-
96-
- will only output values if there has not been any new values in the past time interval passed
97-
98-
### There are also a few Observables that can be created from the Observable object itself:
99-
100-
- They are called by doing: `Observable.<observableFunction>`
101-
102-
`.fromEvent(<eventName>, <element>[, <mapCallback>)`
103-
104-
- will create an observable that will listen for an event on a DOM element
105-
- there is also an optional mappCallback that can be used to map the event that comes through the next observer function
106-
107-
`.fromPromise(<promise>)`
108-
109-
- turns a promise into an observable that emits the value of the promise and then completes
110-
111-
`.interval(<time>[, <start = 0>])`
112-
113-
- emits a number at the specified time interval and increases by one every time
114-
- there is an optional start value that can be passed
115-
116-
`.of(<...values>)`
117-
118-
- takes any number of arguments and emits them in an observable (in order) and then completes
119-
120-
`.range(<start>[, <end>])`
121-
122-
- emits a range of numbers from start to end and then completes
123-
- if only start is given than the range starts at 0 and ends at the start value
58+
- [Documentation on the observables can be seen here](./src/observables/DOCUMENTATION.md)

src/observables/DOCUMENTATION.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
These methods are called by doing: `Observable.<observableFunction>`
2+
3+
`.fromEvent(<eventName>, <element>[, <mapCallback>)`
4+
5+
- will create an observable that will listen for an event on a DOM element
6+
- there is also an optional mappCallback that can be used to map the event that comes through the next observer function
7+
8+
`.fromPromise(<promise>)`
9+
10+
- turns a promise into an observable that emits the value of the promise and then completes
11+
12+
`.interval(<time>[, <start = 0>])`
13+
14+
- emits a number at the specified time interval and increases by one every time
15+
- there is an optional start value that can be passed
16+
17+
`.of(<...values>)`
18+
19+
- takes any number of arguments and emits them in an observable (in order) and then completes
20+
21+
`.range(<start>[, <end>])`
22+
23+
- emits a range of numbers from start to end and then completes
24+
- if only start is given than the range starts at 0 and ends at the start value

src/operators/DOCUMENTATION.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
These methods called by doing: `observableInstance$.<pluginFunction>`
2+
3+
`.map(<mapCallback>)`
4+
5+
- will map each value to a new value using the callback
6+
7+
`.filter(<filterCallback>)`
8+
9+
- will filter out values that you do not want to subscribe to
10+
11+
`.do(<doCallback>)`
12+
13+
- will run some callback before passing the current value to the subscription
14+
15+
`.take(<amount>[, <callback>])`
16+
17+
- will take the amount of values you want (or less if it completes first) and then complete -- this is useful for infinitely running observables
18+
- a callback may be passed to filter out the valeus you want to take
19+
20+
`.first([<callback>])`
21+
22+
- this is an alias for `.take(1[, <callback>])`
23+
24+
`.toPromise()`
25+
26+
- this will do a `.first()` on the observable object and return the value from that to the response from a promise
27+
28+
`.flatMap(<mapCallback>)`
29+
30+
- same as `.map(<mapCallback>)` but will take the value of the callback and turn it from an observable to a value
31+
32+
`.switchMap(<mapCallback>)`
33+
34+
- the value from the mapCallback is an observable and if another value comes through the previous observable is cancelled
35+
- this is useful for things like typeaheads where you dont want a request for every keypress
36+
37+
`.delay(<time>)`
38+
39+
- will delay output from the observable until a specific time interval has passed
40+
41+
`.debounceTime(<time>)`
42+
43+
- will only output values if there has not been any new values in the past time interval passed
44+
45+
`.sum()`
46+
47+
- will result in a sum of all of the values passed to the observer and then will complete
48+
49+
`.average()`
50+
51+
- will result in an average of all of the values passed to the observer and then will complete
52+
53+
`.max()`
54+
55+
- will result in the maximum value passed to the observer then will complete
56+
57+
`.min()`
58+
59+
- will result in the minimum value passed to the observer then will complete
60+
61+
`.count()`
62+
63+
- will result in the amount of values passed to the observer then will complete
64+
65+
`.concat([...anyNumberOfObservables$])`
66+
67+
- will run any number of observables in order and will only complete when the last one is done
68+
69+
`.combineLatest(otherSource$[, combineCallback])`
70+
71+
- will run two observables at the same time
72+
- will only call the observer's next function when both observables have emitted at least one value

0 commit comments

Comments
 (0)