Skip to content

Instantly share code, notes, and snippets.

@mharju
Created January 11, 2012 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mharju/1593894 to your computer and use it in GitHub Desktop.
Save mharju/1593894 to your computer and use it in GitHub Desktop.
Invoke timeout after there has been no events in a given timeout
Observable.FromEvent<MapDragEventArgs>(Map, "MapPan")
.Publish(mapPan_ =>
{
mapPan_.Subscribe( _ =>
Observable.Timer(TimeSpan.FromMilliseconds(500))
.TakeUntil(mapPan_)
.Subscribe(__ => Debug.WriteLine("Timeout"))
);
return mapPan_;
})
.Subscribe(_ => Debug.WriteLine("MapPan"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment