IOptProperty

interface IOptProperty<T : Any> : IOptPropertyView<T> , IMutablePropertyBase<T>

A mutable property that is created in an uninitialized state.

Functions

Link copied to clipboard
open override fun advise(lifetime: Lifetime, handler: (T) -> Unit)

Adds an event subscription. Every time an event occurs, the handler is called, receiving an instance of the event. The subscription is removed when the given lifetime expires.

Link copied to clipboard
abstract fun set(newValue: T)

Sets the property to the given value.

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

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

Properties

Link copied to clipboard
abstract val change: ISource<T>

Allows to subscribe to subsequent changes of the property value. Unlike subscribing to the property directly, the callback will not be immediately called with the current value of the property.

Link copied to clipboard
open val changing: Boolean
Link copied to clipboard
abstract val valueOrNull: T?

Returns the current value of the property, or null if the property has not been initialized.

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
fun <T : Any> IOptProperty<T>.valueOrDefault(default: T): T

Returns the value of the property, or the given default value if the property was not initialized.