Esempio n. 1
0
        public static IAsyncObservable <TSource> Do <TSource>(this IAsyncObservable <TSource> source, IAsyncObserver <TSource> observer)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (observer == null)
            {
                throw new ArgumentNullException(nameof(observer));
            }

            return(Create <TSource>(target => source.SubscribeSafeAsync(AsyncObserver.Do(target, observer))));
        }
Esempio n. 2
0
        public static IAsyncObservable <TSource> Do <TSource>(this IAsyncObservable <TSource> source, Func <Task> onCompleted)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (onCompleted == null)
            {
                throw new ArgumentNullException(nameof(onCompleted));
            }

            return(Create <TSource>(target => source.SubscribeSafeAsync(AsyncObserver.Do(target, onCompleted))));
        }
Esempio n. 3
0
        public static IAsyncObservable <TSource> Do <TSource>(this IAsyncObservable <TSource> source, Action <Exception> onError)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (onError == null)
            {
                throw new ArgumentNullException(nameof(onError));
            }

            return(Create(
                       source,
                       onError,
                       (source, onError, target) => source.SubscribeSafeAsync(AsyncObserver.Do(target, onError))));
        }
Esempio n. 4
0
        public static IAsyncObservable <TSource> Do <TSource>(this IAsyncObservable <TSource> source, Func <TSource, ValueTask> onNext)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (onNext == null)
            {
                throw new ArgumentNullException(nameof(onNext));
            }

            return(Create(
                       source,
                       onNext,
                       (source, onNext, target) => source.SubscribeSafeAsync(AsyncObserver.Do(target, onNext))));
        }
Esempio n. 5
0
        public static IAsyncObservable <TSource> Do <TSource>(this IAsyncObservable <TSource> source, Action <TSource> onNext, Action <Exception> onError, Action onCompleted)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (onNext == null)
            {
                throw new ArgumentNullException(nameof(onNext));
            }
            if (onError == null)
            {
                throw new ArgumentNullException(nameof(onError));
            }
            if (onCompleted == null)
            {
                throw new ArgumentNullException(nameof(onCompleted));
            }

            return(Create(
                       source,
                       (onNext, onError, onCompleted),
                       (source, state, target) => source.SubscribeSafeAsync(AsyncObserver.Do(target, state.onNext, state.onError, state.onCompleted))));
        }