@@ -101,19 +101,6 @@ interface RenderContext<StateT, in OutputT : Any> {
101
101
handler : (ChildOutputT ) -> WorkflowAction <StateT , OutputT >
102
102
): ChildRenderingT
103
103
104
- /* *
105
- * Ensures [worker] is running. When the [Worker] emits an output, [handler] is called
106
- * to determine the [WorkflowAction] to take. When the worker finishes, nothing happens (although
107
- * another render pass may be triggered).
108
- *
109
- * @param key An optional string key that is used to distinguish between identical [Worker]s.
110
- */
111
- fun <T > runningWorker (
112
- worker : Worker <T >,
113
- key : String = "",
114
- handler : (T ) -> WorkflowAction <StateT , OutputT >
115
- )
116
-
117
104
/* *
118
105
* Ensures [sideEffect] is running with the given [key].
119
106
*
@@ -195,6 +182,22 @@ fun <StateT, OutputT : Any> RenderContext<StateT, OutputT>.runningWorker(
195
182
}
196
183
}
197
184
185
+ /* *
186
+ * Ensures [worker] is running. When the [Worker] emits an output, [handler] is called
187
+ * to determine the [WorkflowAction] to take. When the worker finishes, nothing happens (although
188
+ * another render pass may be triggered).
189
+ *
190
+ * @param key An optional string key that is used to distinguish between identical [Worker]s.
191
+ */
192
+ fun <T , StateT , OutputT : Any > RenderContext <StateT , OutputT >.runningWorker (
193
+ worker : Worker <T >,
194
+ key : String = "",
195
+ handler : (T ) -> WorkflowAction <StateT , OutputT >
196
+ ) {
197
+ val workerWorkflow = WorkerWorkflow <T >()
198
+ renderChild(workerWorkflow, props = worker, key = key, handler = handler)
199
+ }
200
+
198
201
/* *
199
202
* Alternative to [RenderContext.actionSink] that allows externally defined
200
203
* event types to be mapped to anonymous [WorkflowAction]s.
0 commit comments