Controlling the Receiving Data Through Operators and Observables

Learn to control the speed of the data transfer in the spaceship video game using Operators and Observables in RxJS.

There is such a thing as receiving data too fast. Most of the time we want all the speed we can get, but depending on the frequency at which the values of the Observable stream, we might want to drop some of the values we receive. We’re now in one of these scenarios. The speed at which we render things onscreen is proportional to the speed of the fastest Observable we have. It turns out that our fastest Observable is too fast for us, and we need to establish a constant update speed in the game.

The sample method is a method in Observable instances that, given a time parameter in milliseconds, returns an Observable that emits the last value emitted by the parent Observable in each time interval.

Get hands-on with 1200+ tech skills courses.