-
-
Notifications
You must be signed in to change notification settings - Fork 4
RxJS Operator Decision Tree
Jamie Mason edited this page Jan 8, 2022
·
2 revisions
Here is the RxJS Operator Decision Tree modelled using JamieMason/self-help.
I have one existing Observable, and
I want to change each emitted value
to be a constant value
to be a value calculated through a formula
I want to pick a property off each emitted value
I want to spy the values being emitted without affecting them
I want to allow some values to pass
based on custom logic
if they are at the start of the Observable
and only the first value
based on a given amount
based on custom logic
if they are exactly the n-th emission
if they are at the end of the Observable
and only the last value
based on a given amount
until another Observable emits a value
I want to ignore values
from the start of the Observable
based on a given amount
based on custom logic
from the end of the Observable
until another Observable emits a value
that match some previous value
according to value equality
emitted just before the current value
emitted some time in the past
according to a key or object property
emitted just before the current value
that occur too frequently
by emitting the first value in each time window
where time windows are determined by another Observable's emissions
where time windows are determined by a time duration
by emitting the last value in each time window
where time windows are determined by another Observable's emissions
where time windows are determined by a time duration
by emitting the last value as soon as enough silence has occured
where the silence duration threshold is determined by another Observable
where the silence duration threshold is determined by a time duration
I want to compute a formula using all values emitted
and only output the final computed value
and output the computed values when the source emits a value
and output the computed values as a nested Observable when the source emits a value
I want to wrap its messages with metadata
that describes each notification (next, error, or complete)
that includes the time past since the last emitted value
after a period of inactivity
I want to throw an error
I want to switch to another Observable
I want to ensure there is only one value
I want to know how many values it emits
I want to prepend one value
I want to delay the emissions
based on a given amount of time
based on the emissions of another Observable
I want to group the values
until the Observable completes
and convert to an array
and convert to a Promise
consecutively in pairs, as arrays
based on a criterion, and output two Observables: those that match the criterion and those that do not
in batches of a particular size
and emit the group as an array
and emit the group as a nested Observable
based on time
and emit the group as an array
and emit the group as a nested Observable
until another Observable emits
and emit the group as an array
and emit the group as a nested Observable
based on the emissions of an Observable created on-demand
and emit the group as an array
and emit the group as a nested Observable
based on another Observable for opening a group, and an Observable for closing a group
and emit the group as an array
and emit the group as a nested Observable
based on a key calculated from the emitted values
I want to start a new Observable for each value
and emit the values from all nested Observables in parallel
where the nested Observable is the same for every value
where the nested Observable is calculated for each value
and emit the values from each nested Observable in order
where the nested Observable is the same for every value
where the nested Observable is calculated for each value
and cancel the previous nested Observable when a new value arrives
where the nested Observable is the same for every value
where the nested Observable is calculated for each value
and ignore incoming values while the current nested Observable has not yet completed
and recursively start a new Observable for each new value
I want to perform custom operations
I want to share a subscription between multiple subscribers
using a conventional Subject
and start it as soon as the first subscriber arrives
and start it manually or imperatively
using a BehaviorSubject
using a ReplaySubject
using an AsyncSubject
using a specific subject implementation
when an error occurs
I want to start a new Observable
I want to re-subscribe
immediately
when another Observable emits
when it completes
I want to re-subscribe
immediately
when another Observable emits
I want to start a new Observable
when it completes, errors or unsubscribes, I want to execute a function
I want to change the scheduler
that routes calls to subscribe
that routes values to observers
I want to combine this Observable with others, and
I want to receive values only from the Observable that emits a value first
I want to output the values from either of them
I want to output a value computed from values of the source Observables
using the latest value of each source whenever any source emits
using the latest value of each source only when the primary Observable emits
using each source value only once
I have some Observables to combine together as one Observable, and
I want to receive values only from the Observable that emits a value first
I want to be notified when all of them have completed
I want to output the values from either of them
I want to output a value computed from values of the source Observables
using the latest value of each source whenever any source emits
using each source value only once
I want to subscribe to each in order
I have no Observables yet, and
I want to create a new Observable
using custom logic
using a state machine similar to a for loop
that throws an error
that just completes, without emitting values
that never emits anything
from an existing source of events
coming from the DOM or Node.js or similar
that uses an API to add and remove event handlers
from a Promise or an event source
that iterates
over the values in an array
over values in a numeric range
over prefined values given as arguments
that emits values on a timer
regularly
with an optional initial delay
which is built on demand when subscribed
I want to convert a callback to an Observable
supporting a conventional callback API
supporting Node.js callback style API