title: How is it possible to stop a debounced Rxjs Observable?
body: <p>I created an observable, which will fire 3 seconds after the last change is made, and calls the <code>publishChange</code> of the service. It works, but I would like to create a <code>doImmediateChange</code> function, which calls <code>publishChange</code> immediately and stops the debounced observable. How is that possible?</p>
  
  <p>My component:</p>
  
  <pre><code>class MyComponent {
      private updateSubject = new Subject&lt;string&gt;();
  
      ngOnInit() {
          this.updateSubject.pipe(
              debounceTime(3000),
              distinctUntilChanged()
          ).subscribe(val =&gt; {
              this.srv.publishChange(val);
          });
      }
  
      doChange(val: string) {
          this.updateSubject.next(val);
      }
  
      doImmediateChange(val: string) {
  
          // Stop the current updateSubject if debounce is in progress and call publish immediately
          // ??
          this.srv.publishChange(val);
  
      }
  
  }
  </code></pre>