MultiSelectionStore

open class MultiSelectionStore<T> : RootStore<List<T>>

This store can be used for components with an internal store that has to deal with a List of some type T.

Use the toggle method to add or remove a selected item from the current selection:

val selection = MultiSelectionStore<String>()
lineUp {
items {
listOf("One", "Two", "Three", "Four", "Five").forEach { value ->
box({
background { color { info } }
}) {
+value
clicks.events.map { value } handledBy selection.toggle
// ^^^^^ ^^^^^^
// pass current value to the ``toggle`` handler!
}
}
}
}
div {
+"Selection:"
ul {
selection.data.renderEach { value ->
li { +value }
}
}
}

RFC: Never ever expose the internal store directly to the client side! Only accept values or Flow]s and return those in order to exchange data with the client!

Constructors

Link copied to clipboard
fun MultiSelectionStore()

Functions

Link copied to clipboard
open suspend override fun enqueue(update: QueuedUpdate<List<T>>)
Link copied to clipboard
open fun errorHandler(exception: Throwable, oldValue: List<T>): List<T>
Link copied to clipboard
open fun handle(errorHandler: ErrorHandler<List<T>>, execute: suspend (List<T>) -> List<T>): SimpleHandler<Unit>
open fun <A> handle(errorHandler: ErrorHandler<List<T>>, execute: suspend (List<T>, A) -> List<T>): SimpleHandler<A>
Link copied to clipboard
open fun <E> handleAndEmit(errorHandler: ErrorHandler<List<T>>, execute: suspend FlowCollector<E>.(List<T>) -> List<T>): EmittingHandler<Unit, E>
open fun <A, E> handleAndEmit(errorHandler: ErrorHandler<List<T>>, execute: suspend FlowCollector<E>.(List<T>, A) -> List<T>): EmittingHandler<A, E>
Link copied to clipboard
open infix fun <E : Event, X : Element> DomListener<E, X>.handledBy(handler: Handler<Unit>)
open infix fun <E : Event, X : Element> DomListener<E, X>.handledBy(execute: suspend (E) -> Unit): Job
open infix fun <E : Event> WindowListener<E>.handledBy(handler: Handler<Unit>)
open infix fun <E : Event> WindowListener<E>.handledBy(execute: suspend (E) -> Unit): Job
open infix fun <A> Flow<A>.handledBy(handler: Handler<A>)
open infix fun <A> Flow<A>.handledBy(execute: suspend (A) -> Unit): Job
Link copied to clipboard
open fun <X> sub(lens: Lens<List<T>, X>): SubStore<List<T>, X>
Link copied to clipboard
open fun syncBy(handler: Handler<Unit>)
open fun syncBy(handler: Handler<List<T>>)
Link copied to clipboard
open fun <I> syncWith(socket: Socket, resource: Resource<List<T>, I>)

Properties

Link copied to clipboard
open override val current: List<T>
Link copied to clipboard
open override val data: Flow<List<T>>
Link copied to clipboard
open override val id: String
Link copied to clipboard
open override val job: Job
Link copied to clipboard
open override val path: String
Link copied to clipboard
val toggle: EmittingHandler<T, List<T>>
Link copied to clipboard
open override val update: SimpleHandler<List<T>>