Skip to content

kite-core / jp.co.cyberagent.kite.core / KiteMutableState

KiteMutableState

interface KiteMutableState<T> :KiteState<T>

Represents a mutable KiteState that provided a setter for value. Do not implemented this interface directly, instead inherits the abstract class AbstractKiteMutableState.

Properties

Name Summary
value abstract var value:T

Extension Functions

Name Summary
asKiteContextElement fun <T :Any>T.asKiteContextElement():Pair<KClass<*>,Any>
Creates a KiteContextElement with the KClass
getValue operator fun <T>KiteState<T>.getValue(thisRef:Nothing?, prop:KProperty<*>):T
Supports delegated property.
setValue operator fun <T>KiteMutableState<T>.setValue(thisRef:Nothing?, prop:KProperty<*>, value:T):Unit
Supports delegated property.
update fun <T>KiteMutableState<T>.update(f: (curr:T) ->T):Unit
Updates the value with the result of function f has one parameter that receives current value.

Inheritors

Name Summary
AbstractKiteMutableState abstract class AbstractKiteMutableState<T> :KiteMutableState<T>
Inherits this abstract class to create custom KiteMutableState. When KiteMutableState.value changed, calls notifyChanged to notify its subscriber. When access the getter of KiteMutableState.value, calls subscribe to add itself as the dependency to any potential subscriber.