package application.model import kotlin.properties.Delegates class ObservableState { val listeners: MutableList = mutableListOf() var state: State by Delegates.observable( initialValue = State.CLUSTERED_MESSAGES, onChange = { _, _, new -> run { listeners.forEach { it.onValueChanged(new) } } } ) }