Exemple #1
0
        public static ISubscription bind <A>(
            this IObservable <A> observable, IDisposableTracker tracker, Fn <A, Coroutine> f
            )
        {
            var lastCoroutine = F.none <Coroutine>();

            void stopOpt()
            {
                foreach (var c in lastCoroutine)
                {
                    c.stop();
                }
            };
            var sub = observable.subscribe(
                NoOpDisposableTracker.instance,
                a => {
                stopOpt();
                lastCoroutine = f(a).some();
            }
                ).andThen(stopOpt);

            tracker.track(sub);
            return(sub);
        }
Exemple #2
0
 public static void onCompleteCancellable <A>(this Future <A> future, IDisposableTracker tracker, Act <A> action) =>
 tracker.track(onCompleteCancellable(future, action));