melatonina
11/30/2020, 11:55 AMfun Button.actions(): Flow<Unit> = callbackFlow {
val handler = EventHandler<ActionEvent> {
offer(Unit)
}
addEventHandler(ActionEvent.ACTION, handler)
awaitClose { removeEventHandler(ActionEvent.ACTION, handler) }
}
and then use the debounce()
method: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/debounce.html
Thread in Slack Conversation