I have an observable that is emitting items quite fast. I want to limit those items. My operator should only emit 1 element maximum per x seconds, ignoring the rest.
Concretely, I would like to create an operator like this:
As you can appreciate, it will only emit the first item, ignoring the rest for 5 time units. A, B and C are on t=1, t=2 and t=3 respectively. B and C are ignored, because the resulting sequence should emit a maximum of 1 items each 5 time units.
When D comes, it's emitted because it comes when 5 time units are due, but E is not, because D has been emitted. Finally, the original sequence doesn't emit anything for a long time, until F comes. The derived sequence emits D.
Notice that the derived sequence emits the first element, and it won't emit any other item until the specified time span has passed. Once the time span is due, it's ready to accept another item.
How can I create this operator?