Your question is stated imprecisely. If you want t...
# javafx
m
Your question is stated imprecisely. If you want to implement debounce on the action event of a button, you could transform the events into a Kotlin Flow, with something like this:
Copy code
fun 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