Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 031e887

Browse files
Updating forkJoin docs
1 parent 5be5683 commit 031e887

25 files changed

Lines changed: 1723 additions & 1325 deletions

dist/rx.all.compat.js

Lines changed: 256 additions & 205 deletions
Large diffs are not rendered by default.

dist/rx.all.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.js

Lines changed: 255 additions & 204 deletions
Large diffs are not rendered by default.

dist/rx.all.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.experimental.js

Lines changed: 258 additions & 208 deletions
Large diffs are not rendered by default.

dist/rx.experimental.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.experimental.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/api/core/operators/forkjoin.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,58 @@
1-
### `Rx.Observable.forkJoin(...args)`
1+
### `Rx.Observable.forkJoin(...args, [resultSelector])`
22
[Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/tests/observable/forkjoin.js "View in source")
33

44
Runs all observable sequences in parallel and collect their last elements.
55

66
#### Arguments
77
1. `args` *(Arguments | Array)*: An array or arguments of Observable sequences or Promises to collect the last elements for.
8+
2. `resultSelector`: `Function` - The result selector from all the values produced. If not specified, `forkJoin` will return the results as an array.
89

910
#### Returns
10-
*(`Observable`)*: An observable sequence with an array collecting the last elements of all the input sequences.
11+
*(`Observable`)*: An observable sequence with an array collecting the last elements of all the input sequences or the result of the result selector if specified.
1112

1213
#### Example
1314
```js
14-
/* Using observables and Promises */
15+
/* Without a selector */
1516
var source = Rx.Observable.forkJoin(
16-
Rx.Observable.return(42),
17-
Rx.Observable.range(0, 10),
18-
Rx.Observable.from([1,2,3]),
19-
RSVP.Promise.resolve(56)
17+
Rx.Observable.return(42),
18+
Rx.Observable.range(0, 10),
19+
Rx.Observable.from([1,2,3]),
20+
RSVP.Promise.resolve(56)
2021
);
2122

2223
var subscription = source.subscribe(
23-
function (x) {
24-
console.log('Next: ' + x);
25-
},
26-
function (err) {
27-
console.log('Error: ' + err);
28-
},
29-
function () {
30-
console.log('Completed');
31-
});
24+
function (x) {
25+
console.log('Next: %s', x);
26+
},
27+
function (err) {
28+
console.log('Error: %s', err);
29+
},
30+
function () {
31+
console.log('Completed');
32+
});
3233

3334
// => Next: [42, 9, 3, 56]
3435
// => Completed
36+
37+
var source = Rx.Observable.forkJoin(
38+
Rx.Observable.just(42),
39+
Rx.Observable.just(56),
40+
function (x, y) { return x + y; }
41+
);
42+
43+
var subscription = source.subscribe(
44+
function (x) {
45+
console.log('Next: %s', x);
46+
},
47+
function (err) {
48+
console.log('Error: %s', err);
49+
},
50+
function () {
51+
console.log('Completed');
52+
});
53+
54+
// => Next: 98
55+
// => Completed
3556
```
3657

3758
### Location

0 commit comments

Comments
 (0)