Skip to content

Commit

Permalink
docs(README): update FAQ a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Nov 28, 2016
1 parent b8d6995 commit f22f09c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -974,24 +974,16 @@ If you find yourself wanting to use `imitate()` with a MemoryStream, you should

**Q: What's the difference between xstream and RxJS?**

A: Read this [blog post](http://staltz.com/why-we-built-xstream.html) on the topic.
A: Read this [blog post](http://staltz.com/why-we-built-xstream.html) on the topic. In short:

**Q: What is the equivalent of [`withLatestFrom`](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-withLatestFrom) in xstream?**

`withLatestFrom` is implemented as an extra named [`sampleCombine`](https://github.com/staltz/xstream/blob/master/EXTRA_DOCS.md#sampleCombine). It may also be composed with existing operators:

<!-- skip-example -->
```js
A.withLatestFrom(B, (a, b) => a + b)
```

can be composed in *xstream* with
- xstream Streams are multicast always.
- RxJS Observables are unicast by default, and opt-in multicast.
- xstream has few operators *as a feature* (helps against decision paralysis).
- RxJS has many operators *as a feature* (helps for flexibility and power).

```js
B.map(b => A.map(a => a + b)).flatten()
```
**Q: What is the equivalent of [`withLatestFrom`](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-withLatestFrom) in xstream?**

And can be interpreted/read as "when a `B` event happens, remember it and map it to all the subsequent events of `A` mapped to `a + b`".
A: `withLatestFrom` is implemented as an extra named [`sampleCombine`](https://github.com/staltz/xstream/blob/master/EXTRA_DOCS.md#sampleCombine).

-----

Expand Down
22 changes: 7 additions & 15 deletions markdown/footer.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,16 @@ If you find yourself wanting to use `imitate()` with a MemoryStream, you should

**Q: What's the difference between xstream and RxJS?**

A: Read this [blog post](http://staltz.com/why-we-built-xstream.html) on the topic.
A: Read this [blog post](http://staltz.com/why-we-built-xstream.html) on the topic. In short:

**Q: What is the equivalent of [`withLatestFrom`](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-withLatestFrom) in xstream?**

`withLatestFrom` is implemented as an extra named [`sampleCombine`](https://github.com/staltz/xstream/blob/master/EXTRA_DOCS.md#sampleCombine). It may also be composed with existing operators:

<!-- skip-example -->
```js
A.withLatestFrom(B, (a, b) => a + b)
```
- xstream Streams are multicast always.
- RxJS Observables are unicast by default, and opt-in multicast.
- xstream has few operators *as a feature* (helps against decision paralysis).
- RxJS has many operators *as a feature* (helps for flexibility and power).

can be composed in *xstream* with

```js
B.map(b => A.map(a => a + b)).flatten()
```
**Q: What is the equivalent of [`withLatestFrom`](http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-withLatestFrom) in xstream?**

And can be interpreted/read as "when a `B` event happens, remember it and map it to all the subsequent events of `A` mapped to `a + b`".
A: `withLatestFrom` is implemented as an extra named [`sampleCombine`](https://github.com/staltz/xstream/blob/master/EXTRA_DOCS.md#sampleCombine).

-----

Expand Down

0 comments on commit f22f09c

Please sign in to comment.