stream
fun <T> stream(initial: T, config: Stream<T>.() -> Stream<T>? = null, handler: (T) -> Unit = {}): ComponentStreamProperty<T>
Creates a property that is backed by a StreamSource
When ever a value is written to the property it will also by passed into the stream. The stream will be configured using config and will be then be subscribed to.
This way we can implement e.g. debouncing of input values, for example:
private var search by stream("", { debounce(300) }) { reload() }Content copied to clipboard
Parameters
initial
The initial value
config
Configures the stream before subscribing to it
handler
Handler for values published by the stream