Package-level declarations

Types

Link copied to clipboard
data class SimpleContext<STATE : Any>(val state: STATE)

Represents the current context in which a simple orbit is executing.

Link copied to clipboard
class SimpleSyntax<S : Any, SE : Any>(val containerContext: ContainerContext<S, SE>)
Link copied to clipboard
data class SubclassStateContainerContext<S : Any, SE : Any, T : S>(val settings: RealSettings, val postSideEffect: suspend (SE) -> Unit, getState: () -> T, val reduce: suspend ((T) -> S) -> Unit, val subscribedCounter: SubscribedCounter)
Link copied to clipboard
class SubclassStateSimpleSyntax<S : Any, SE : Any, T : S>(val containerContext: SubclassStateContainerContext<S, SE, T>)

Functions

Link copied to clipboard
fun <STATE : Any, SIDE_EFFECT : Any> ContainerHost<STATE, SIDE_EFFECT>.blockingIntent(registerIdling: Boolean = true, transformer: suspend SimpleSyntax<STATE, SIDE_EFFECT>.() -> Unit)

Build and execute an intent on Container in a blocking manner, without dispatching.

Link copied to clipboard
fun <STATE : Any, SIDE_EFFECT : Any> ContainerHost<STATE, SIDE_EFFECT>.intent(registerIdling: Boolean = true, transformer: suspend SimpleSyntax<STATE, SIDE_EFFECT>.() -> Unit): Job

Build and execute an intent on Container.

Link copied to clipboard
suspend fun <S : Any, SE : Any> SimpleSyntax<S, SE>.postSideEffect(sideEffect: SE)
suspend fun <S : Any, SE : Any, T : S> SubclassStateSimpleSyntax<S, SE, T>.postSideEffect(sideEffect: SE)

Side effects allow you to deal with things like tracking, navigation etc.

Link copied to clipboard
suspend fun <S : Any, SE : Any> SimpleSyntax<S, SE>.reduce(reducer: SimpleContext<S>.() -> S)
suspend fun <S : Any, SE : Any, T : S> SubclassStateSimpleSyntax<S, SE, T>.reduce(reducer: SimpleContext<T>.() -> S)

Reducers reduce the current state and incoming events to produce a new state.

Link copied to clipboard
suspend fun <S : Any, SE : Any> SimpleSyntax<S, SE>.repeatOnSubscription(block: suspend CoroutineScope.() -> Unit)
Link copied to clipboard
suspend fun <S : Any, T : S> Flow<S>.runOn(clazz: KClass<T>, predicate: (T) -> Boolean = { true }, block: suspend (capturedState: T) -> Unit)

This API is intended to simplify and add type-safety to working with sealed class states. This can be applied to any Flow of states, not just the Container's own. The main purpose of this API is to help you work with child container states.

suspend fun <S : Any, SE : Any, T : S> SimpleSyntax<S, SE>.runOn(clazz: KClass<T>, predicate: (T) -> Boolean = { true }, block: suspend SubclassStateSimpleSyntax<S, SE, T>.() -> Unit)

This API is intended to simplify and add type-safety to working with sealed class states.

Link copied to clipboard
suspend fun <STATE : Any, SIDE_EFFECT : Any> ContainerHost<STATE, SIDE_EFFECT>.subIntent(transformer: suspend SimpleSyntax<STATE, SIDE_EFFECT>.() -> Unit)

Used for parallel decomposition or subdivision of a larger intent into smaller parts.