Operators

Creating Observables

Operator

Description

create

Create an Observable from scratch by calling observer methods programmatically.

empty

Creates an Observable that emits no item and completes immediately.

never

Creates an Observable that never completes.

throw

Creates an Observable that terminates with an error.

from_

Convert some other object or data structure into an Observable.

interval

Create an Observable that emits a sequence of integers spaced by a particular time interval.

just

Convert an object or a set of objects into an Observable that emits that object or those objects.

range

Create an Observable that emits a range of sequential integers.

repeat_value

Create an Observable that emits a particular item or sequence of items repeatedly.

start

Create an Observable that emits the return value of a function.

timer

Create an Observable that emits a single item after a given delay.

Transforming Observables

Filtering Observables

Operator

Description

debounce

Only emit an item from an Observable if a particular timespan has passed without it emitting another item.

distinct

Suppress duplicate items emitted by an Observable.

element_at

Emit only item n emitted by an Observable.

filter

Emit only those items from an Observable that pass a predicate test.

first

Emit only the first item, or the first item that meets a condition, from an Observable.

ignore_elements

Do not emit any items from an Observable but mirror its termination notification.

last

Emit only the last item emitted by an Observable.

sample

Emit the most recent item emitted by an Observable within periodic time intervals.

skip

Suppress the first n items emitted by an Observable.

skip_last

Suppress the last n items emitted by an Observable.

take

Emit only the first n items emitted by an Observable.

take_last

Emit only the last n items emitted by an Observable.

Combining Observables

Operator

Description

combine_latest

When an item is emitted by either of two Observables, combine the latest item emitted by each Observable via a specified function and emit items based on the results of this function.

join

Combine items emitted by two Observables whenever an item from one Observable is emitted during a time window defined according to an item emitted by the other Observable.

merge

Combine multiple Observables into one by merging their emissions.

start_with

Emit a specified sequence of items before beginning to emit the items from the source Observable.

switch_latest

Convert an Observable that emits Observables into a single Observable that emits the items emitted by the most-recently-emitted of those Observables.

zip

Combine the emissions of multiple Observables together via a specified function and emit single items for each combination based on the results of this function.

fork_join

Wait for Observables to complete and then combine last values they emitted into a tuple.

Error Handling

Operator

Description

catch

Continues observable sequences which are terminated with an exception by switching over to the next observable sequence.

retry

If a source Observable sends an onError notification, resubscribe to it in the hopes that it will complete without error.

Utility Operators

Operator

Description

delay

Shift the emissions from an Observable forward in time by a particular amount.

do

Register an action to take upon a variety of Observable lifecycle events.

materialize

Materializes the implicit notifications of an observable sequence as explicit notification values.

dematerialize

Dematerializes the explicit notification values of an observable sequence as implicit notifications.

observe_on

Specify the scheduler on which an observer will observe this Observable.

subscribe

Operate upon the emissions and notifications from an Observable.

subscribe_on

Specify the scheduler an Observable should use when it is subscribed to.

time_interval

Convert an Observable that emits items into one that emits indications of the amount of time elapsed between those emissions.

timeout

Mirror the source Observable, but issue an error notification if a particular period of time elapses without any emitted items.

timestamp

Attach a timestamp to each item emitted by an Observable.

Conditional and Boolean Operators

Operator

Description

all

Determine whether all items emitted by an Observable meet some criteria.

amb

Given two or more source Observables, emit all of the items from only the first of these Observables to emit an item.

contains

Determine whether an Observable emits a particular item or not.

default_if_empty

Emit items from the source Observable, or a default item if the source Observable emits nothing.

sequence_equal

Determine whether two Observables emit the same sequence of items.

skip_until

Discard items emitted by an Observable until a second Observable emits an item.

skip_while

Discard items emitted by an Observable until a specified condition becomes false.

take_until

Discard items emitted by an Observable after a second Observable emits an item or terminates.

take_while

Discard items emitted by an Observable after a specified condition becomes false.

Mathematical and Aggregate Operators

Operator

Description

average

Calculates the average of numbers emitted by an Observable and emits this average.

concat

Emit the emissions from two or more Observables without interleaving them.

count

Count the number of items emitted by the source Observable and emit only this value.

max

Determine, and emit, the maximum-valued item emitted by an Observable.

min

Determine, and emit, the minimum-valued item emitted by an Observable.

reduce

Apply a function to each item emitted by an Observable, sequentially, and emit the final value.

sum

Calculate the sum of numbers emitted by an Observable and emit this sum.

Connectable Observable Operators

Operator

Description

connect

Instruct a connectable Observable to begin emitting items to its subscribers.

publish

Convert an ordinary Observable into a connectable Observable.

ref_count

Make a Connectable Observable behave like an ordinary Observable.

replay

Ensure that all observers see the same sequence of emitted items, even if they subscribe after the Observable has begun emitting items.