Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Created June 28, 2010 23:56
Show Gist options
  • Save mattpodwysocki/456571 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/456571 to your computer and use it in GitHub Desktop.
private IObservable<string[]> DictionaryLookup(string key)
{
...
}
private string FormatAsHtml(string[] results)
{
...
}
var textBox = new TextBox();
...
var keyUp = Observable.FromEvent<KeyEventArgs>(textBox, "KeyUp")
.Select(ev => ((TextBox)ev.Sender).Text);
var query = keyUp.Throttle(TimeSpan.FromMilliseconds(500)).Let(_keyUp =>
from key in _keyUp
from d in DictionaryLookup(key).TakeUntil(_keyUp)
select FormatAsHtml(d));
var query2 = keyUp.Throttle(TimeSpan.FromMilliseconds(500))
.Select(key => DictionaryLookup(key))
.Switch()
.Select(d => FormatAsHtml(d));
@adamhill
Copy link

adamhill commented Jul 9, 2010

Throttling events in RxNet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment