I know that there is an easy way to do this – but it has beaten me tonight …
I want to know if two events occur within 300 milliseconds of each other, as in a double click.
Two leftdown mouse clicks in 300 milliseconds – I know this is what the reactive framework was built for – but damn if I can find a good doc that has simple examples for all the extenstion operatores – Throttle, BufferWithCount, BufferWithTime – all of which just werent’ doing it for me….
The
TimeIntervalmethod will give you the time between values.If you want to be sure that triple clicks don’t trigger values, you could just use
Repeaton a hot observable (I’ve used aFastSubjecthere as the clicks will all come on one thread and therefore don’t require the heaviness of the normal Subjects):