tc39 / proposal-observable

Observables for ECMAScript
https://tc39.github.io/proposal-observable/
3.06k stars 90 forks source link

Cleanup function should be passed to the SubscriptionObserver #200

Open lxsmnsyc opened 5 years ago

lxsmnsyc commented 5 years ago

an issue with how the cleanup function is defined in the SubscriberFunction is that the SubscriberFunction must return the function. This is problematic if the SubscriberFunction blocks the execution for too long until it receives the cleanup function.

In RxJava, we can solve this by replacing the internal cancellable/disposable state of the Emitter (SubscriptionObserver) by calling setDisposable(Disposable) or setCancellable(Cancellable).