Experimenting with Observables

Let's see some interesting constructors like 'of' for creating observables and operators like 'take', 'delay' for manipulating data.

You’ve only dipped your toes into the massive toolbox Rx provides. Read on to learn about operators beyond map and takeUntil. map has worked for everything so far, but what happens when we throw an asynchronous wrench in the works or tackle multiple operations inside?

Constructors and operators

This section covers the of constructor and the take and delay operators.

They’re included in the first chapter because all three are useful for hands-on experimentation with observables. If you’re not quite sure how an operator works, these tools let you get an easily understood observable stream up and running to test the confusing operator.

The of Constructor

The of constructor allows for the easy creation of an observable out of a known data source. It takes any number of arguments and returns an observable containing each argument as a separate event.

The following example logs the three strings passed in as separate events.

Get hands-on with 1400+ tech skills courses.