This is a simple library for using the mediator pattern in your typescript and deno projects. While not entirely a true port, the MediatR library for .NET is a direct influence.
Repository
Current version released
2 years ago
Dependencies
std
Jimmy
This is a simple library for using the mediator pattern in your typescript and deno projects. It is meant to be a direct port of the Mediatr library for .NET Core.
Example Usage
Deno
import { Mediator } from "./mediator.ts";
import { Request } from "./request.ts";
const mediator = new Mediator();
class TestRequest extends Request<string> {
constructor(public name: string) { }
}
mediator.handle(TestRequest, (request: TestRequest) => {
return `Hello ${request.name}`;
});
mediator.send(new TestRequest("Jimmy")).then(response => {
console.log(response);
});