DispatchStepDecorator

Wraps a single step of the dispatch chain so instrumentation can measure it.

A decorator is handed each named step, a middleware or the reducer, and returns a replacement that does whatever timing or bookkeeping it needs around the original.

Usage:

val decorator = DispatchStepDecorator { name, step ->
{ action ->
val start = currentTimeMillis()
try {
step(action)
} finally {
println("$name took ${currentTimeMillis() - start}ms")
}
}
}

See also

Functions

Link copied to clipboard
abstract fun decorate(name: String, step: suspend (ModuleAction) -> Unit): suspend (ModuleAction) -> Unit