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
3 years ago
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.
Why Jimmy?
- Former US President Jimmy Carter was known for his ability at being a great mediator.
- The .NET Core library MediatR was written by Jimmy Bogard.
- Coicdence? I think not.
Example Usage
Deno
import { Mediator, Request } from "https://deno.land/x/jimmy@v0.1.0-preview3/mod.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);
});