StreamSource

interface StreamSource<T> : Stream<T>

Define a stream source to which new values can be written.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract operator override fun invoke(): T

Returns the current value of the stream

abstract operator fun invoke(next: T)

Sends the next value to the stream

open operator fun invoke(block: (T) -> T)

Calls the block with the current value of the stream and sends to return value to the stream.

Link copied to clipboard
open fun modify(block: T.() -> T)

Modifies the current value by calling the block and sends it the result as the next value.

Link copied to clipboard
abstract fun removeAllSubscriptions()

Removes all subscriptions

Link copied to clipboard
abstract fun subscribeToStream(sub: (T) -> Unit): Unsubscribe

Adds a subscription to the stream.

Properties

Link copied to clipboard
open val readonly: Stream<T>

Get the readonly version of this stream.

Link copied to clipboard
abstract val subscriptions: Set<StreamHandler<T>>

The subscription the stream source has.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <T> StreamSource<T>.persistInLocalStorage(    key: String,     serializer: KSerializer<T>,     codec: Json = defaultJson): StreamSource<T>

Converts a StreamSource so that it will persist its values in the local storage under the given key.