Skip to content

Instantly share code, notes, and snippets.



Created Sep 18, 2015
What would you like to do?
public static class Ex {
public static IObservable<T> TakeUntilIdleFor<T>(this IObservable<T> source, TimeSpan idleTime)
return Observable.Create<T>(o =>
var published = source.Publish();
var idle = published.Select(_ => Observable.Timer(idleTime)).Switch();
return new CompositeDisposable(published.Connect(), published.TakeUntil(idle).Subscribe(o));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment