Alright so, I'm looking to use a flow to help mana...
# coroutines
g
Alright so, I'm looking to use a flow to help manage text changes from a javafx UI element. I have a
Flow<Change<oldValue: String, newValue: String>>
and I want to have a behaviour whereby: 1. we use
debounce
for 200 ms, such that as fast edits are made to this text, no changes are published 2. when there is a 200ms pause, it publishes a
Change
with the old value from before any changes were made, and the new value after all changes 3. this can be short-circuited by "focus lost", if focus changes from true to false the 200ms wait is interrupted, a change is published right away, and any pending changes are cancelled. Anybody done something like this? Care to share? If not, care to speculate with me?
this is my first effort: https://gist.github.com/Groostav/09b754d1169295efda2cfa28d9e4eaba I have yet to do serious testing
d
Which pending changes? Text changes or focus changes?
g
Text changes, a focus change causes any pending text changes to be flushed
so im at thie point now where im starting to think ive found a bug in Flow
ill have to put in a bunch of work to get an SCCEE and im in crunch right now 😞