WithValidator

interface WithValidator<D, T> : Store<D>

Interface which RootStores can implement to mark them that they have a ComponentValidator. Then all SubStores can evaluate if a ComponentValidationMessage is available for their field.

The validator property must set with a ComponentValidator when implementing this interface. To automatically call the validator when the model in RootStore is changed, use the validate convenience function in the init block:

 val store = object : RootStore<MyData>(MyData()), WithValidator<MyData, String> {
override val validator = MyDataValidator

init { validate("my metadata") }
}

Functions

enqueue
Link copied to clipboard
js
abstract suspend fun enqueue(update: QueuedUpdate<D>)
equals
Link copied to clipboard
js
open operator fun equals(other: Any?): Boolean
errorHandler
Link copied to clipboard
js
open fun errorHandler(exception: Throwable, oldValue: D): D
handle
Link copied to clipboard
js
open fun handle(errorHandler: ErrorHandler<D>, execute: suspend (D) -> D): SimpleHandler<Unit>
open fun <A> handle(errorHandler: ErrorHandler<D>, execute: suspend (D, A) -> D): SimpleHandler<A>
handleAndEmit
Link copied to clipboard
js
open fun <E> handleAndEmit(errorHandler: ErrorHandler<D>, execute: suspend FlowCollector<E>.(D) -> D): EmittingHandler<Unit, E>
open fun <A, E> handleAndEmit(errorHandler: ErrorHandler<D>, execute: suspend FlowCollector<E>.(D, A) -> D): 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> WindowListener<E>.handledBy(handler: Handler<Unit>)
open infix fun <A> Flow<A>.handledBy(handler: Handler<A>)
hashCode
Link copied to clipboard
js
open fun hashCode(): Int
syncBy
Link copied to clipboard
js
open fun syncBy(handler: Handler<D>)
open fun syncBy(handler: Handler<Unit>)
syncWith
Link copied to clipboard
js
open fun <I> syncWith(socket: Socket, resource: Resource<D, I>)
toString
Link copied to clipboard
js
open fun toString(): String
validate
Link copied to clipboard
js
open fun validate(metadata: T)
Convenience method for calling the ComponentValidator every time the model is changed.

Properties

current
Link copied to clipboard
js
abstract val current: D
data
Link copied to clipboard
js
abstract val data: Flow<D>
id
Link copied to clipboard
js
abstract val id: String
job
Link copied to clipboard
js
abstract val job: Job
update
Link copied to clipboard
js
abstract val update: Handler<D>
validator
Link copied to clipboard
js
abstract val validator: ComponentValidator<D, T>
ComponentValidator for model data of type D