subscribe

@JvmName(name = "subscribeConsume")
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> CoroutineScope.subscribe(store: ImmutableStore<S, I, A>, crossinline consume: suspend Provider<S, I, A>.() -> Unit): Job

Subscribe to the store. An overload of Store.subscribe that is applied on CoroutineScope.


@JvmName(name = "subscribeAndRender")
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> CoroutineScope.subscribe(store: ImmutableStore<S, I, A>, crossinline consume: suspend (action: A) -> Unit, crossinline render: suspend (state: S) -> Unit): Job

Subscribe to the store and invoke consume and render in parallel in the provided scope.

  • This function does not handle the lifecycle of the UI layer. For that, see platform implementations.

  • Store's subscribers will not wait until the store is launched when they subscribe to the store. Such subscribers will not receive state updates or actions. Don't forget to launch the store.

See also


@JvmName(name = "subscribeAndRender")
inline fun <S : MVIState, I : MVIIntent, A : MVIAction> CoroutineScope.subscribe(store: ImmutableStore<S, I, A>, crossinline render: suspend (state: S) -> Unit): Job

Subscribe to the store and invoke render. This does not collect store's actions.

  • This function does not handle the lifecycle of the UI layer. For that, see platform implementations.

  • Store's subscribers will not wait until the store is launched when they subscribe to the store. Such subscribers will not receive state updates or actions. Don't forget to launch the store.

See also


fun <S : MVIState, I : MVIIntent, A : MVIAction, T : ActionConsumer<A>, StateConsumer<S>> T.subscribe(store: ImmutableStore<S, I, A>, scope: CoroutineScope): Job

Subscribe to the store and invoke ActionConsumer.consume and StateConsumer.render in parallel in the provided scope.

  • This function does not handle the lifecycle of the UI layer. For that, see platform implementations.

  • Store's subscribers will not wait until the store is launched when they subscribe to the store. Such subscribers will not receive state updates or actions. Don't forget to launch the store.

See also


fun <S : MVIState, I : MVIIntent, A : MVIAction> StateConsumer<S>.subscribe(store: ImmutableStore<S, I, A>, scope: CoroutineScope): Job

Subscribe to the store and invoke StateConsumer.render in the provided scope.

  • This function does not handle the lifecycle of the UI layer. For that, see platform implementations.

  • Store's subscribers will not wait until the store is launched when they subscribe to the store. Such subscribers will not receive state updates or actions. Don't forget to launch the store.

See also