If we try to compare this to the Observer pattern, we will see that some concepts reoccur, such as Observer. In this pattern, the Observer was notified when something happened and the Subject took the initiative to change. Looking at the previous code, it looks like the Observer is the one that takes the initiative to change. This isn't strictly true though; it is more of a mediator, which brings us to our next concept in RxJS, the Producer. The Producer is responsible for generating the values we need. By involving a Producer in our code, we see that the Observer is more of a mediator:
// rxjs-example/producer.jsconst Rx = require("rxjs/Rx");class Producer { constructor() { this.counterMax = 5; this.current = 0; } hasValues() { ...