ObservableSelectedVessel.kt
435 Bytes
package application.model
import kotlin.properties.Delegates
class ObservableSelectedVessel {
val listeners: MutableList<SelectedVesselListener> = mutableListOf()
var vessel: Vessel by Delegates.observable(
initialValue = Vessel(null),
onChange = { _, _, new ->
run {
listeners.forEach {
it.onValueChanged(new)
}
}
}
)
}