@@ -44,9 +44,9 @@ import kotlin.reflect.KType
44
44
interface WorkflowContext <StateT : Any , in OutputT : Any > {
45
45
46
46
/* *
47
- * Given a function that takes an [event][EventT] and can mutate the state or emit an output, returns
48
- * a function that will perform that workflow update when called with an event.
49
- * The returned function is valid until the next [ compose][Workflow.compose] pass.
47
+ * Given a function that takes an [event][EventT] and can mutate the state or emit an output,
48
+ * returns a function that will perform that workflow update when called with an event.
49
+ * The returned function is valid until the next compose pass.
50
50
*
51
51
* For example, if you have a rendering type of `Screen`:
52
52
*
@@ -73,16 +73,16 @@ interface WorkflowContext<StateT : Any, in OutputT : Any> {
73
73
): EventHandler <EventT >
74
74
75
75
/* *
76
- * Ensures that the [channel][ReceiveChannel] returned from [channelProvider] is subscribed to, and
77
- * will send anything emitted on the channel to [handler] as a [ChannelUpdate].
76
+ * Ensures that the [channel][ReceiveChannel] returned from [channelProvider] is subscribed to,
77
+ * and will send anything emitted on the channel to [handler] as a [ChannelUpdate].
78
78
*
79
79
* This method ensures that only one subscription is active at a time for the given [type]+[key].
80
- * If this method is called in two or more consecutive [Workflow. compose] invocations with the same
81
- * key, [channelProvider] will only be invoked for the first one, and the returned channel will be
82
- * re-used for all subsequent invocations, until a [Workflow. compose] invocation does _not_ call this
83
- * method with an equal key. At that time, the channel will be [cancelled][ReceiveChannel.cancel],
84
- * with the assumption that cancelling the channel will release any resources allocated by the
85
- * [channelProvider].
80
+ * If this method is called in two or more consecutive ` compose` invocations with the
81
+ * same key, [channelProvider] will only be invoked for the first one, and the returned channel
82
+ * will be re-used for all subsequent invocations, until a ` compose` invocation does
83
+ * _not_ call this method with an equal key. At that time, the channel will be
84
+ * [cancelled][ReceiveChannel.cancel], with the assumption that cancelling the channel will
85
+ * release any resources allocated by the [channelProvider].
86
86
*
87
87
* @param type The [KType] that represents both the type of data source (e.g. `ReceiveChannel` or
88
88
* `Deferred`) and the element type [E].
@@ -101,18 +101,21 @@ interface WorkflowContext<StateT : Any, in OutputT : Any> {
101
101
102
102
/* *
103
103
* Ensures [child] is running as a child of this workflow, and returns the result of its
104
- * [ compose][Workflow.compose] method.
104
+ * ` compose` method.
105
105
*
106
- * **Never call [Workflow.compose] directly, always do it through this context method.**
106
+ * **Never call [StatefulWorkflow.compose] or [StatelessWorkflow.compose] directly, always do it
107
+ * through this context method.**
107
108
*
108
109
* 1. If the child _wasn't_ already running, it will be started either from
109
110
* [initialState][Workflow.initialState] or its snapshot.
110
- * 2. If the child _was_ already running, The workflow's [onInputChanged][Workflow.onInputChanged]
111
- * method is invoked with the previous input and this one.
112
- * 3. The child's [compose][Workflow.compose] method is invoked with `input` and the child's state.
111
+ * 2. If the child _was_ already running, The workflow's
112
+ * [onInputChanged][StatefulWorkflow.onInputChanged] method is invoked with the previous input
113
+ * and this one.
114
+ * 3. The child's `compose` method is invoked with `input` and the child's state.
113
115
*
114
116
* After this method returns, if something happens that trigger's one of `child`'s handlers, and
115
- * that handler emits an output, the function passed as [handler] will be invoked with that output.
117
+ * that handler emits an output, the function passed as [handler] will be invoked with that
118
+ * output.
116
119
*
117
120
* @param key An optional string key that is used to distinguish between workflows of the same
118
121
* type.
@@ -130,14 +133,15 @@ interface WorkflowContext<StateT : Any, in OutputT : Any> {
130
133
* will send anything emitted on the channel to [handler] as a [ChannelUpdate].
131
134
*
132
135
* This method ensures that only one subscription is active at a time for the given key.
133
- * If this method is called in two or more consecutive [Workflow. compose] invocations with the same
136
+ * If this method is called in two or more consecutive ` compose` invocations with the same
134
137
* key+[channelProvider] type, the provider will only be invoked for the first one, and the returned
135
- * channel will be re-used for all subsequent invocations, until a [Workflow. compose] invocation does
136
- * _not_ call this method with an equal key+type. At that time, the channel will be
138
+ * channel will be re-used for all subsequent invocations, until a ` compose` invocation
139
+ * does _not_ call this method with an equal key+type. At that time, the channel will be
137
140
* [cancelled][ReceiveChannel.cancel], with the assumption that cancelling the channel will release
138
141
* any resources allocated by the [channelProvider].
139
142
*
140
- * @param key An optional string key that is used to distinguish between subscriptions of the same type.
143
+ * @param key An optional string key that is used to distinguish between subscriptions of the same
144
+ * type.
141
145
* @param handler A function that returns the [WorkflowAction] to perform when the channel emits.
142
146
*
143
147
* @see WorkflowContext.onReceive
@@ -168,7 +172,8 @@ fun <StateT : Any, OutputT : Any, ChildOutputT : Any, ChildRenderingT : Any>
168
172
// @formatter:on
169
173
170
174
/* *
171
- * Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit output.
175
+ * Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit
176
+ * output.
172
177
*/
173
178
fun <InputT : Any , StateT : Any , OutputT : Any , ChildRenderingT : Any >
174
179
WorkflowContext <StateT , OutputT >.compose (
@@ -182,7 +187,8 @@ fun <InputT : Any, StateT : Any, OutputT : Any, ChildRenderingT : Any>
182
187
// @formatter:on
183
188
184
189
/* *
185
- * Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit output.
190
+ * Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit
191
+ * output.
186
192
*/
187
193
fun <StateT : Any , OutputT : Any , ChildRenderingT : Any >
188
194
WorkflowContext <StateT , OutputT >.compose (
0 commit comments