ISource

interface ISource<out T>

An object that allows to subscribe to events of type T.

Functions

Link copied to clipboard
abstract 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.

Inheritors

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

Extensions

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>.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
fun <T> ISource<T>.asProperty(defaultValue: T): IPropertyView<T>
Link copied to clipboard
fun <T> ISource<T>.distinct(): ISource<T>
Link copied to clipboard
fun <T> ISource<T>.filter(f: (T) -> Boolean): ISource<T>
Link copied to clipboard
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.

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 <TSrc> ISource<TSrc>.flowInto(lifetime: Lifetime, target: IMutablePropertyBase<TSrc>)
fun <TSrc : Any, TDst : Any> ISource<IViewableSet.Event<TSrc>>.flowInto(    lifetime: Lifetime,     target: IMutableViewableSet<TDst>,     tf: (TSrc) -> TDst)
fun <TSrc : Any, TDst : Any> ISource<IViewableList.Event<TSrc>>.flowInto(    lifetime: Lifetime,     target: IMutableViewableList<TDst>,     tf: (TSrc) -> TDst)
fun <TKey : Any, TValue : Any> ISource<IViewableMap.Event<TKey, TValue>>.flowInto(    lifetime: Lifetime,     target: IMutableViewableMap<TKey, TValue>,     tf: (TValue) -> TValue)
Link copied to clipboard
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
fun <T : Any> ISource<T>.throttleLast(timeout: Duration, scheduler: IScheduler): ISource<T>