Package com.squareup.workflow1

Types

NoopWorkflowInterceptor
Link copied to clipboard
object NoopWorkflowInterceptor : WorkflowInterceptor

A WorkflowInterceptor that does not intercept anything.

RenderingAndSnapshot
Link copied to clipboard
class RenderingAndSnapshot<out RenderingT>(rendering: RenderingT, snapshot: TreeSnapshot)

Tuple of rendering and snapshot used by renderWorkflowIn.

RuntimeConfig
Link copied to clipboard
interface RuntimeConfig

A specification of the Workflow Runtime.

SimpleLoggingWorkflowInterceptor
Link copied to clipboard
open class SimpleLoggingWorkflowInterceptor : WorkflowInterceptor

A WorkflowInterceptor that just prints all method calls using log.

TreeSnapshot
Link copied to clipboard
class TreeSnapshot

Aggregate of all the snapshots of a tree of workflows.

WorkflowExperimentalRuntime
Link copied to clipboard

This is used to mark any experimental runtimes.

WorkflowInterceptor
Link copied to clipboard
interface WorkflowInterceptor

Provides hooks into the workflow runtime that can be used to instrument or modify the behavior of workflows.

Functions

renderWorkflowIn
Link copied to clipboard
fun <PropsT, OutputT, RenderingT> renderWorkflowIn(workflow: Workflow<PropsT, OutputT, RenderingT>, scope: CoroutineScope, props: StateFlow<PropsT>, initialSnapshot: TreeSnapshot? = null, interceptors: List<WorkflowInterceptor> = emptyList(), runtimeConfig: RuntimeConfig = RuntimeConfig.DEFAULT_CONFIG, onOutput: suspend (OutputT) -> Unit): StateFlow<RenderingAndSnapshot<RenderingT>>

Launches the workflow in a new coroutine in scope and returns a StateFlow of its renderings and snapshots. The workflow tree is seeded with initialSnapshot and the current value value of props. Subsequent values emitted from props will be used to re-render the workflow.