<@U0BFDUP0E> I see your problem, maybe this could ...
# coroutines
d
@jw I see your problem, maybe this could do using pipelines?
Copy code
// Can use broadcast channel for multiple listeners
val channel = Channel() // or (Channel.CONFLATED)

// event producer, offer handles backpressure by not sending anything and returning false, unless there is a buffer
val event = produce { 
      view.onClick {
            offer(Unit)
     }
}

// Use to create backpressure for throttle time
launch { 
      event.consumeEach { 
            // Ignore all events for this time period
            delay(SAMPLING_TIME)
            send(it)
      }
}

// event receiver
channel.consumeEach {
            // use the event as soon as it happens, spaced by SAMPLING_TIME
            // ....

      }