@@ -10,12 +10,30 @@ import kotlin.jvm.JvmOverloads
1010
1111/* *
1212 * An atomic operation that updates the state of a [Workflow], and also optionally emits an output.
13+ *
14+ * A [WorkflowAction]'s [apply] method is executed in the context of an [Updater][WorkflowAction.Updater],
15+ * which provides access to the current [props][WorkflowAction.Updater.props] and
16+ * [state][WorkflowAction.Updater.state],
17+ * along with a [setOutput][WorkflowAction.Updater.setOutput] function.
18+ * The [state][WorkflowAction.Updater.state] can be updated with a new [StateT] instance
19+ * that will become the current one after the [apply] function finishes.
20+ *
21+ * It is possible for one [WorkflowAction] to delegate to another, although the API is a bit opaque:
22+ *
23+ * val actionA = action {
24+ * }
25+ *
26+ * val actionB = action {
27+ * val (newState, outputApplied) = actionA.applyTo(props, state)
28+ * state = newState
29+ * outputApplied.output?.value?.let { setOutput(it) }
30+ * }
1331 */
1432public abstract class WorkflowAction <in PropsT , StateT , out OutputT > {
1533
1634 /* *
17- * The context for calls to [WorkflowAction.apply]. Allows the action to set the
18- * [state], and to emit the [ setOutput].
35+ * The context for calls to [WorkflowAction.apply]. Allows the action to read and change the
36+ * [state], and to emit an [output][ setOutput] value .
1937 *
2038 * @param state the state that the workflow should move to. Default is the current state.
2139 */
0 commit comments