Companion

object Companion

The ready-made strategies. Each one answers Dispatch.Run when no active event matches the events it looks at.

Properties

Link copied to clipboard

Every event runs at once, in a coroutine of its own, whatever else is active. The default.

Functions

Link copied to clipboard
inline fun <reified T : UiEvent> DropIfAlreadyRunning(): DispatchStrategy<T>

An event is ignored while any event that is a T is running or waiting. For actions that must not run twice, such as a submit button tapped again.

inline fun <reified T : UiEvent> DropIfAlreadyRunning(noinline key: (T) -> Any?): DispatchStrategy<T>

An event is ignored while an event that is a T and has the same key, such as the id of an item, is running or waiting.

Link copied to clipboard
inline fun <reified T : UiEvent> Latest(): DispatchStrategy<T>

A new event cancels every active event that is a T and then runs. For input that makes the previous work pointless, such as a search box or a slider.

inline fun <reified T : UiEvent> Latest(noinline key: (T) -> Any?): DispatchStrategy<T>

A new event cancels the active events that are a T and have the same key, such as the id of an item, and then runs.

Link copied to clipboard
inline fun <reified T : UiEvent> Sequential(): DispatchStrategy<T>

The events that are a T run one after the other, in the order they were sent. For changes that must be applied in order, such as a counter tapped several times. A run that fails does not stop the ones after it.

inline fun <reified T : UiEvent> Sequential(noinline key: (T) -> Any?): DispatchStrategy<T>

The events that are a T and have the same key, such as the id of an item, run one after the other. Events with different keys do not wait for each other.