Skip to content

Instantly share code, notes, and snippets.

@iknowcodesoup
Created November 10, 2018 18:56
Show Gist options
  • Save iknowcodesoup/058c23643d9311642079037bf4134817 to your computer and use it in GitHub Desktop.
Save iknowcodesoup/058c23643d9311642079037bf4134817 to your computer and use it in GitHub Desktop.
Observable subject -
/* Use with caution! http://davesexton.com/blog/post/To-Use-Subject-Or-Not-To-Use-Subject.aspx */
public class SomeClass {
private readonly Subject<int> triggerableObservable =
new Subject<int>();
public IObservable<int> TriggeredObservable => triggerableObservable.AsObservable();
private IDisposable subscription;
public SomeClass()
{
SetObservables();
}
private void SetObservables()
{
subscription = TriggeredObservable
.Throttle(TimeSpan.FromMilliseconds(750))
.Subscribe(x => { });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment