blob: 6eef6f98535ca0f62547b5b6812fed01418f0aa0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package pl.treksoft.kvision.data
import kotlin.properties.ObservableProperty
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
interface DataComponent {
var container: DataUpdatable?
fun <T> obs(initialValue: T): ReadWriteProperty<Any?, T> = object : ObservableProperty<T>(initialValue) {
override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) {
container?.update()
}
}
}
open class BaseDataComponent : DataComponent {
override var container: DataUpdatable? = null
}
|