Last active
August 29, 2015 14:01
-
-
Save rogeralsing/fe5a57ad7308332a4334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chatMessages = GetObservableOfChatMessages(); | |
var chatIsIdle = chatMessages. _dontknow_ (TimeSpan.FromSeconds(5)); | |
chatMessages.Subscribe (msg => Console.WriteLine("{0} says: {1}",msg.User,msg.Text)); | |
//I want this to occur every time the chatmessages observable have been silent for 5 sec | |
//not just once | |
chatIsIdle.Subscribe ( ... => Console.WriteLine("Chat is idle..."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could make an extension method, BufferUntilInactive
And just ignore the return values, so your above code looks like
I got this from a similar question I asked on SO a while back, so credit to Colonel Panic for his answer, http://stackoverflow.com/q/8849810/255231