This is RxJS v 4. Find the latest version here
Use this page to find the instance operator implemented by the Observable
type that fits your needs:
Using an existing sequence | I want to change each value | map/select | ||
I want to pull a property off each value | pluck | |||
I want to be notified of values without affecting them | do/tap doOnNext/tapOnNext doOnError/tapOnError doOnCompleted/tapOnCompleted |
|||
I want to include values | based on custom logic | filter/where | ||
from the start of the sequence | take | |||
based on custom logic | takeWhile | |||
from the end of the sequence | takeLast | |||
until another sequence emits a value or completes | takeUntil | |||
I want to ignore values | altogether | ignoreElements | ||
from the start of the sequence | skip | |||
based on custom logic | skipWhile | |||
from the end of the sequence | skipLast | |||
until another sequence emits a value | skipUntil | |||
that have the same value as the previous | distinctUntilChanged | |||
that occur too frequently | throttle | |||
I want to compute | the sum | of its values | sum | |
the average | average | |||
using custom logic | and only output the final value | aggregate reduce |
||
and output the values as they are calculated | scan | |||
I want to wrap its messages with metadata | that describes each message | materialize | ||
that includes the time past since the last value | timeInterval | |||
that includes a timestamp | timestamp | |||
after a period of inactivity | I want to throw an error | timeout | ||
I want to switch to another sequence | timeout | |||
I want ensure there is only one value | and throw an error if there are more or less than one value | single | ||
and use the default value if there are no values | singleOrDefault | |||
I want to only take the first value | and throw an error if there are no values | first | ||
and use the default value if there are no values | firstOrDefault | |||
within a time period | sample | |||
I want to only take the last value | and error if there are no values | last | ||
and use the default value if there are no values | lastOrDefault | |||
I want to know how many values it contains | count | |||
I want to know if it includes a value | contains | |||
I want to know if a condition is satisfied | by any of its values | some | ||
by all of its values | all/every | |||
I want to delay messages by a specific amount of time | delay | |||
based on custom logic | delayWithSelector | |||
I want to group the values | until the sequence completes |
toArray toMap toSet |
||
using custom logic | as arrays | buffer | ||
as sequences | window | |||
in batches of a particular size | as arrays | bufferWithCount | ||
as sequences | windowWithCount | |||
based on time | as arrays | bufferWithTime | ||
as sequences | windowWithTime | |||
based on time or count, whichever happens first | as arrays | bufferWithTimeOrCount | ||
as sequences | windowWithTimeOrCount | |||
based on a key | until the sequence completes | groupBy | ||
and control the lifetime of each group | groupByUntil | |||
I want to start a new sequence for each value | and emit the values from all sequences in parallel | flatMap/selectMany | ||
and emit the values from each sequence in order | concatMap/selectConcat | |||
and cancel the previous sequence when a new value arrives | flatMapLatest/selectSwitch | |||
and recursively start a new sequence for each new value | expand | |||
and emit values from all sequences depending for onNext, onError, and onCompleted in parallel | flatMapObserver/selectManyObserver | |||
and emit values from all sequences depending for onNext, onError, and onCompleted in order | concatMapObserver/selectConcatObserver | |||
I want to combine it with another | And be notified when both have completed | forkJoin | ||
I want to perform complex operations without breaking the fluent calls | let | |||
I want to share a subscription between multiple subscribers | using a specific subject implementation | multicast | ||
publish share |
||||
and suppy the last value to future subscribers |
publishLast shareLast |
|||
and replay a default or the latest value to future subscribers |
publishValue shareValue |
|||
and replay n number of values to future subscribers |
replay shareReplay |
|||
when an error occurs | I want to re-subscribe | retry | ||
I want to start a new sequence | catch | |||
that depends on the error | catch | |||
when it completes | I want to re-subscribe | repeat | ||
I want to start a new sequence | concat | |||
when it completes or errors | I want to start a new sequence | onErrorResumeNext | ||
when it completes, errors or unsubscribes | I want to execute a function | finally | ||
I want to change the scheduler that routes | calls to subscribe | subscribeOn | ||
messages | observeOn | |||
Using two sequences | I want to decide which to receive values from | based on which one has values first | amb | |
I want to determine if their values are equal | sequenceEqual | |||
I want to combine their values | only when the first sequence emits, using the latest value from each | withLatestFrom | ||
in order | reusing the latest value when unchanged | combineLatest | ||
using each value only once | zip | |||
that share overlapping “lifetime” that I choose | and be notified for each combination | join | ||
and be given a sequence of “rights” for each “left” | groupJoin | |||
I want to include values from both | merge |
Reference
Concepts