IViewable

interface IViewable<out T>

An object that allows to subscribe to changes of its contents.

Functions

Link copied to clipboard
abstract fun view(lifetime: Lifetime, handler: (Lifetime, T) -> Unit)

Adds a subscription to changes of the contents of the object.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
fun <T : Any> IViewable<T?>.viewNotNull(lifetime: Lifetime, handler: (Lifetime, T) -> Unit)

Adds a subscription to changes to this viewable's contents and filters out null values. The subscription is removed when the given lifetime expires.

Link copied to clipboard
fun IViewable<Boolean>.whenFalse(lifetime: Lifetime, action: (Lifetime) -> Unit)

Executes the given action every time the value of the property changes to false.

Link copied to clipboard
fun IViewable<Boolean>.whenTrue(lifetime: Lifetime, action: (Lifetime) -> Unit)

Executes the given action every time the value of the property changes to true.