Package-level declarations
Types
Type alias for a Redux middleware equivalent. The key difference is that dispatch, getState and next are provided by a MiddlewareScope.
Example of defining a middleware:
fun customMiddleware(): Middleware<AppState> = {
{ action ->
when (action) {
is CustomAction -> dispatch(OtherAction)
else -> next(action)
}
}
}
The scope that provides necessary operations for a middleware.
Functions
Creates a dispatch function that consumes actions with given supertype T. Other actions are passed to the next middleware.
Creates a middleware with consumingDispatch that consumes actions with given supertype T. Other actions are passed to the next middleware.
This function only returns given dispatch. It has a few benefits over simple DispatchFunction lambda that are illustrated with this example:
Creates a middleware.
Creates a dispatch function that executes a given block and passes every action to the next middleware.
Creates a middleware with translucentDispatch that executes a given block and passes every action to the next middleware.