La referencia de la API está disponible solo en inglés por ahora.

MiddlewareSpec<S = any, EM extends EventMapBase = EventMapBase>

interface
types.ts:799

Middleware specification with optional event targeting and metadata.

- If when is omitted, middleware receives ALL events. - Use when to filter which events the middleware processes. - Middleware runs BEFORE reducers and can cancel event propagation.

Type parameters

NameTypeDescription
SStore state (readonly).
EMextends EventMapBaseEvent map.

Properties

NameTypeDescription
meta?EventConsumerMeta<"middleware">Optional metadata for debugging tools and DevTools integration.
middlewareMiddlewareFunction<S, EM>Middleware function: (state, event, emit) => boolean (synchronous). Return false to cancel event propagation.
when?When<EM>Event targeting (optional). If omitted, middleware receives ALL events.