DispatchScope

interface DispatchScope<out State>

The scope for accessing current state of the Redux store and dispatching actions. Beside standard Redux operations, it introduces a DispatchClosure mechanism.

Functions

Link copied to clipboard
abstract fun dispatch(action: Action)

This is equivalent to Redux dispatch.

Properties

Link copied to clipboard
abstract val closure: DispatchClosure

There is no equivalent to this in original Redux. It provides a current DispatchClosure. It remains immutable. However, elements inside might mutate depending on their implementation.

Link copied to clipboard
abstract val currentState: State

This is equivalent to Redux getState.

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
val DispatchScope<*>.coroutineScope: CoroutineScope

Returns CoroutineScope associated with a store.

Link copied to clipboard
Link copied to clipboard

Dispatches action and expects any middleware to launch a single foreground job logically associate with it. Coroutine is launched in a scope provided by DispatchCoroutineScope.

Link copied to clipboard
fun DispatchScope<*>.dispatchJobIn(action: ForegroundJobAction, scope: CoroutineScope): Job

Dispatches action and expects any middleware to launch a single foreground job logically associate with it. Coroutine is launched in the scope.

Link copied to clipboard

Dispatches action and expects any middleware to launch a single foreground job logically associate with it. This function suspends until foreground job is finished. When coroutine that calls this function is cancelled, foreground job is also cancelled.

Link copied to clipboard
fun DispatchScope<*>.synchronized(block: suspend DispatchScope<*>.() -> Unit): Job

Runs given block as a coroutine in DispatchScope.coroutineScope. Effectively it ensures that any operation on a DispatchScope inside a block runs on proper thread.

Link copied to clipboard
inline fun <T> DispatchScope<*>.withLocalClosure(closure: DispatchClosure, newFrame: Boolean = false, block: DispatchScope<*>.() -> T): T

Adds local changes to LocalClosureContainer with a given closure for a time of block execution.