The examples in RxJS README seem to suggest that we should subscribe to the source. In other words: we are waiting for the source to send events. In this sense, the sources seem push-based : the source decides when it creates new elements.
This contrasts, however, with iterators, where strictly speaking, new elements need to be created only when requested , that is, when called next(). This behavior pull-based, also known as the lazy generation.
For example, a stream may return all Wikipedia pages for primes. Elements are created only if you request them, because the generation of all of them is quite investment, and perhaps only 2 or 3 of them can be read in any case.
Can RxJS also have this pull-based behavior, so that new elements are only generated when they are requested?
The backpressure page seems to indicate that this is not yet possible.
source
share