예제 #1
0
        public static IAsyncObservable <TSource> Delay <TSource>(this IAsyncObservable <TSource> source, TimeSpan dueTime)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(Create <TSource>(async observer =>
            {
                var(sink, drain) = await AsyncObserver.Delay(observer, dueTime).ConfigureAwait(false);

                var subscription = await source.SubscribeSafeAsync(sink).ConfigureAwait(false);

                return StableCompositeAsyncDisposable.Create(subscription, drain);
            }));
        }