ObservableCurrentTime.kt 409 Bytes
package application.model

import kotlin.properties.Delegates

class ObservableCurrentTime {

    val listeners: MutableList<CurrentTime> = mutableListOf()

    var value: Int by Delegates.observable(
        initialValue = 0,
        onChange = { _, _, new ->
            run {
                listeners.forEach {
                    it.onValueChanged(new)
                }
            }
        }
    )

}