-1

So I have an observable with a debounce of 300ms.
It does an API-call after a key-up event.

There's an API-lock in place to prevent future calls until it is completed, but I would also like to check if the observable is running (that's making the API call) and stop it.

How would this be accomplished?

Tim Nuwin
  • 2,775
  • 2
  • 29
  • 63

1 Answers1

0

Not sure if you can stop observable, but you can use Subscription (or Disposable in rx2). You can use it to unsubscribe from your observable when you are done with it. Subscription returns when you call your subscribe method. Just save it at this moment and then call unsubscribe, when you don't need to receive events anymore

A. Shevchuk
  • 2,109
  • 14
  • 23