kotlin.properties.Delegates.observable

observable

inline fun <T> observable(
    initialValue: T, 
    crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Unit
): ReadWriteProperty<Any?, T>

Returns a property delegate for a read/write property that calls a specified callback function when changed.

Parameters

initialValue - the initial value of the property.

onChange - the callback which is called after the change of the property is made. The value of the property has already been changed when this callback is in