Operators specific for RxJS 5
As we said, there are extra operators in RxJS 5 that aren't available in RxPHP right now. There are in fact, quite of few of them, but many are very similar in principle. We mentioned some of them in
Chapter 07
, Implementing Socket IPC and WebSocket Server/Client, such as audit()
or throttle(),
including all their variations that use timeouts or other Observables to create time windows. Also, all operators derived from buffer()
aren't so interesting for us.
We'll have a look at the three of them that serve some other interesting purposes.
The expand() operator
The interesting thing about the expand()
operator is that it works recursively. It takes as a parameter a callback that needs to return another Observable. The callback is then applied to all values emitted by the returned Observable. This goes on as long as the returned Observables emit values.
Consider the following example where we use expand()
to recursively multiply a value by two as...