persistInLocalStorage

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.

Every published value is sent to the local storage. When the stream is initialized the latest value will be loaded from the local storage.