Blame view

src/main/kotlin/application/model/ObservableSelectedVessel.kt 435 Bytes
2bbe36a1b   lsagona   addd the possibil...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  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)
                  }
              }
          }
      )
  }