MapRouter

open class MapRouter(defaultRoute: Map<String, String>) : Router<Map<String, String>>

Represents the current Route as Map of Strings.

Parameters

defaultRoute

default Route to start with.

Constructors

MapRouter
Link copied to clipboard
js
fun MapRouter(defaultRoute: Map<String, String> = emptyMap())
default Route to start with.

Functions

enqueue
Link copied to clipboard
js
open suspend override fun enqueue(update: QueuedUpdate<Map<String, String>>)
abstract method defining, how this Store handles an Update
errorHandler
Link copied to clipboard
js
open fun errorHandler(exception: Throwable, oldValue: Map<String, String>): Map<String, String>
Default error handler printing the error to console and keeping the previous value.
handle
Link copied to clipboard
js
open fun handle(errorHandler: ErrorHandler<Map<String, String>> = ::errorHandler, execute: suspend (Map<String, String>) -> Map<String, String>): SimpleHandler<Unit>
Factory method to create a SimpleHandler that does not take an Action
open fun <A> handle(errorHandler: ErrorHandler<Map<String, String>> = ::errorHandler, execute: suspend (Map<String, String>, A) -> Map<String, String>): SimpleHandler<A>
Factory method to create a SimpleHandler mapping the actual value of the Store and a given Action to a new value.
handleAndEmit
Link copied to clipboard
js
open fun <E> handleAndEmit(errorHandler: ErrorHandler<Map<String, String>> = ::errorHandler, execute: suspend FlowCollector<E>.(Map<String, String>) -> Map<String, String>): EmittingHandler<Unit, E>
factory method to create an EmittingHandler that does not take an action in it's execute-lambda.
open fun <A, E> handleAndEmit(errorHandler: ErrorHandler<Map<String, String>> = ::errorHandler, execute: suspend FlowCollector<E>.(Map<String, String>, A) -> Map<String, String>): EmittingHandler<A, E>
Factory method to create a EmittingHandler taking an action-value and the current store value to derive the new value.
handledBy
Link copied to clipboard
js
open infix fun <E : Event, X : Element> DomListener<E, X>.handledBy(handler: Handler<Unit>)
Connects Events to a Handler.
open infix fun <E : Event, X : Element> DomListener<E, X>.handledBy(execute: suspend (E) -> Unit): Job
Connects a Flow to a suspendable execute function.
open infix fun <E : Event> WindowListener<E>.handledBy(handler: Handler<Unit>)
Connects Events to a Handler.
open infix fun <E : Event> WindowListener<E>.handledBy(execute: suspend (E) -> Unit): Job
Connects a Flow to a suspendable execute function.
open infix fun <A> Flow<A>.handledBy(handler: Handler<A>)
Connects a Flow to a Handler.
open infix fun <A> Flow<A>.handledBy(execute: suspend (A) -> Unit): Job
Connects a Flow to a suspendable execute function.
select
Link copied to clipboard
js
open fun select(key: String): Flow<Pair<String?, Map<String, String>>>
Selects with the given key a Pair of the value and all routing parameters as Map.
open fun select(key: String, orElse: String): Flow<String>
Returns the value for the given key from the routing parameters.
sub
Link copied to clipboard
js
open fun <X> sub(lens: Lens<Map<String, String>, X>): SubStore<Map<String, String>, X>
create a SubStore that represents a certain part of your data model.
syncBy
Link copied to clipboard
js
open fun syncBy(handler: Handler<Unit>)
calls a handler on each new value of the Store
open fun syncBy(handler: Handler<Map<String, String>>)
calls a handler on each new value of the Store
syncWith
Link copied to clipboard
js
open fun <I> syncWith(socket: Socket, resource: Resource<Map<String, String>, I>)

Properties

current
Link copied to clipboard
js
open override val current: Map<String, String>
represents the current value of the Store
data
Link copied to clipboard
js
open override val data: Flow<Map<String, String>>
the Flow representing the current value of the Store.
id
Link copied to clipboard
js
open override val id: String
id of this Store.
job
Link copied to clipboard
js
open override val job: Job
Job for launching coroutines in.
navTo
Link copied to clipboard
js
open val navTo: SimpleHandler<Map<String, String>>
Navigates to the new given route provided as T.
path
Link copied to clipboard
js
open override val path: String
Path of this Store derived from the underlying model.
update
Link copied to clipboard
js
open override val update: SimpleHandler<Map<String, String>>
a simple SimpleHandler that just takes the given action-value as the new value for the Store.