legacy-workflow-rx2 / com.squareup.workflow.legacy.rx2 / EventSelectBuilder

EventSelectBuilder

class EventSelectBuilder<E : Any, R : Any>
Deprecated: Use com.squareup.workflow.Workflow

The receiver for lambdas passed to EventChannel.select. For usage see the documentation for EventChannel.

Functions

onEvent

fun <T : E> onEvent(handler: (T) -> R): Unit

Selects an event by type T.

onSuccess

fun <T : Any> onSuccess(single: Single<out T>, handler: (T) -> R): Unit

Defines a case that is selected when single completes successfully, and is passed the value emitted by single.

onWorkerResult

fun <I : Any, O : Any> WorkflowPool.onWorkerResult(worker: Worker<I, O>, input: I, name: String = "", handler: (O) -> R): Unit

Selected when the given worker produces its result. If worker wasn't already running, it is started the given input. The caller must ensure that the result is consumed, or else call WorkflowPool.abandonWorker.

onWorkflowUpdate

fun <S : Any, E : Any, O : Any> WorkflowPool.onWorkflowUpdate(handle: Handle<S, E, O>, handler: (WorkflowUpdate<S, E, O>) -> R): Unit

Starts the Workflow described by handle if it wasn't already running. This case is selected when the Workflow's state changes from the given, or the Workflow completes.