MultiplexingProperty

class MultiplexingProperty<T, K : Any>(lifetime: Lifetime, selector: (T) -> K) : IProperty<T?>

Constructors

Link copied to clipboard
constructor(lifetime: Lifetime, selector: (T) -> K)

Properties

Link copied to clipboard
open override 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
open override var value: T?

Returns the current value of the property.

Functions

Link copied to clipboard
fun addComponent(property: IProperty<T?>, key: K?)
fun addComponent(property: IProperty<T?>, key: K?, componentLifetime: Lifetime)
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
fun IVoidSource.advise(lifetime: Lifetime, handler: () -> Unit)
Link copied to clipboard
fun <T> ISource<T>.adviseEternal(handler: (T) -> Unit)

Adds an event subscription that never gets removed.

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

Adds an event subscription that filters out null values.

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

Executes handler exactly once when the source fires an event with a non-null value, then terminates the subscription

Link copied to clipboard
fun <T> ISource<T>.adviseOnce(lifetime: Lifetime, handler: (T) -> Unit)

Executes handler exactly once then terminates the subscription

Link copied to clipboard
fun <T> ISource<T>.adviseSuspend(lifetime: Lifetime, scheduler: IScheduler, handler: suspend (T) -> Unit)
fun <T> ISource<T>.adviseSuspend(lifetime: Lifetime, context: CoroutineContext, handler: suspend (T) -> Unit)
Link copied to clipboard
fun <T> ISource<T>.adviseUntil(lifetime: Lifetime, handler: (T) -> Boolean)

Holds subscription until handler returns true or lifetime is terminated

Link copied to clipboard
fun <T> ISource<T>.adviseWithPrev(lifetime: Lifetime, handler: (prev: Maybe<T>, cur: T) -> Unit)
Link copied to clipboard
Link copied to clipboard
fun <T> ISource<T>.asProperty(defaultValue: T): IPropertyView<T>
Link copied to clipboard
fun <T> IMutablePropertyBase<T>.bind(lifetime: Lifetime, setValue: (value: T) -> Unit, valueUpdated: ((value: T) -> Unit) -> Unit)
Link copied to clipboard
fun <T1, T2, TRes> IPropertyView<T1>.compose(other: IPropertyView<T2>, composer: (T1, T2) -> TRes): IPropertyView<TRes>
Link copied to clipboard
fun <T : Any> IPropertyView<T?>.debounceNotNull(timeout: Duration, scheduler: IScheduler): ISource<T?>
Link copied to clipboard
Link copied to clipboard
fun <T> ISource<T>.filter(f: (T) -> Boolean): ISource<T>
Link copied to clipboard

fun <T> ISource<T>.flowInto(lifetime: Lifetime, target: ISignal<T>)

Whenever a change happens in this source, fires a change in the target signal of the same type.

fun <TSrc, TDst> ISource<TSrc>.flowInto(lifetime: Lifetime, target: IMutablePropertyBase<TDst>, tf: (TSrc) -> TDst)

Whenever a change happens in this source, changes the target property of the same type.

fun <TSource, TTarget> ISource<TSource>.flowInto(lifetime: Lifetime, target: ISignal<TTarget>, tf: (TSource) -> TTarget)

Whenever a change happens in this source, fires a change in the target signal obtained by running the given tf function.

Link copied to clipboard
open operator fun invoke(): T?
Link copied to clipboard
fun <T, R> IPropertyView<T>.map(f: (T) -> R): IPropertyView<R>

fun <T, R> ISource<T>.map(f: (T) -> R): ISource<R>

Returns a new source which remaps events happening in this source using the given function f.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun <T : Any> ISource<T?>.nextNotNullValue(): T
Link copied to clipboard
fun <T : Any> ISource<T?>.nextNotNullValueAsync(lifetime: Lifetime): Deferred<T>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun <T> ISource<T>.nextValue(condition: (T) -> Boolean = { true }): T
Link copied to clipboard
fun <T> ISource<T>.nextValueAsync(lifetime: Lifetime, condition: (T) -> Boolean = { true }): Deferred<T>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun set(newValue: T?)

Sets the property to the given value.

Link copied to clipboard
fun <T> IProperty<T?>.setValue(lifetime: Lifetime, value: T?)

Sets the property value to the given value for the duration of the lifetime, and resets it to null when the lifetime is terminated.

Link copied to clipboard
Link copied to clipboard
fun <T : Any> ISource<T>.throttleLast(timeout: Duration, scheduler: IScheduler): ISource<T>
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.

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.