Render Context Interceptor
Provides hooks for intercepting calls to a BaseRenderContext, to be used from onRender.
For use by onRender methods that want to hook into action and side effect events. See documentation on methods for more information about the individual hooks:
E.g.:
override fun <P, S, O, R> onRender(
renderProps: P,
renderState: S,
proceed: (P, S, RenderContextInterceptor<P, S, O>) -> R,
session: WorkflowSession
): R = proceed(renderProps, renderState, object : RenderContextInterceptor<P, S, O> {
override fun onActionSent(
action: WorkflowAction<P, S, O>,
proceed: (WorkflowAction<P, S, O>) -> Unit
) {
log("Action sent: $action")
proceed(action)
}
override fun onRunningSideEffect(
key: String,
sideEffect: suspend () -> Unit,
proceed: (key: String, sideEffect: suspend () -> Unit) -> Unit
) {
proceed(key) {
log("Side effect started: $key")
sideEffect()
log("Side effect ended: $key")
}
}
})
Functions
on Action Sent
Link copied to clipboard
on Render Child
Link copied to clipboard
Intercepts calls to BaseRenderContext.renderChild, allowing the interceptor to wrap or replace the child Workflow, its childProps, key, and the handler function to be applied to the child's output.
on Running Side Effect
Link copied to clipboard
Intercepts calls to BaseRenderContext.runningSideEffect, allowing the interceptor to wrap or replace the sideEffect and its key. This could be used to prevent a side effect from running, or to augment it with further effects.