interface Middleware
thefrontside/effectionA general function that can be used to surround any other function or value.
Examples
Example 1
import type { Operation } from "effection";
function* DbMiddleware(args, next): <[string], Operation<{ id: number; title: string }[]>> {
let [sql] = args;
let start = Date.now();
try {
return yield* next(...args);
} finally {
console.log("query ms", Date.now() - start, sql);
}
};
Type Parameters
TArgs extends unknown[]
TReturn