const middleware: Middleware = (api: MiddewareApi) => {
// create a queue
// create a stream from the queue
// start a background process that reads from the stream
return (next) => (action) => {
try {
// call the next middleware in the chain
return next(action);
} finally {
// offer the action to the queue
}
}
}
const middleware: Middleware = (api: MiddewareApi) => {
// create a queue
// create a stream from the queue
// start a background process that reads from the stream
return (next) => (action) => {
try {
// call the next middleware in the chain
return next(action);
} finally {
// offer the action to the queue
}
}
}