r4zzz4k
01/30/2018, 6:06 PMval boolProperty = SimpleBooleanProperty()
you can get current value, set new value and listen for changes in it.
TornadoFX, which is Kotlin library based on JavaFX, has the following neat feature: https://github.com/edvin/tornadofx-guide/blob/master/part2/Property%20Delegates.md#alternative-property-syntax
Basically they allow you to use Kotlin's delegated property to wrap SimpleBooleanProperty
into var bool: Boolean by boolProperty
having delegated getter and setter.
To me observable properties seem to be similar to ConflatedChannel
. Does the following make sense?
operator fun <E> ConflatedBroadcastChannel<E>.getValue(thisRef: Any, property: KProperty<*>) = this.value
operator fun <E> ConflatedBroadcastChannel<E>.setValue(thisRef: Any, property: KProperty<*>, value: E) = send(value)
If so, is this a candidate for kotlinx.coroutines
or this is something too use-case-specific for the library?