Blame view

src/main/kotlin/application/model/ObservableState.kt 428 Bytes
9e952e84e   lsagona   add message clust...
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 ObservableState {
      val listeners: MutableList<StateListener> = mutableListOf()
  
      var state: State by Delegates.observable(
          initialValue = State.CLUSTERED_MESSAGES,
          onChange = { _, _, new ->
              run {
                  listeners.forEach {
                      it.onValueChanged(new)
                  }
              }
          }
      )
  }