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

MultiSelectionStore
Link copied to clipboard
js
fun MultiSelectionStore()

Functions

enqueue
Link copied to clipboard
js
open suspend override fun enqueue(update: QueuedUpdate<List<T>>)
errorHandler
Link copied to clipboard
js
open fun errorHandler(exception: Throwable, oldValue: List<T>): List<T>
handle
Link copied to clipboard
js
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>
handleAndEmit
Link copied to clipboard
js
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>
handledBy
Link copied to clipboard
js
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
sub
Link copied to clipboard
js
open fun <X> sub(lens: Lens<List<T>, X>): SubStore<List<T>, X>
syncBy
Link copied to clipboard
js
open fun syncBy(handler: Handler<Unit>)
open fun syncBy(handler: Handler<List<T>>)
syncWith
Link copied to clipboard
js
open fun <I> syncWith(socket: Socket, resource: Resource<List<T>, I>)

Properties

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