Follow this to get started and use mediator easily.
To install mediator and get started use:
npm install @arashghafoori/mediator
For a more complicated project with many handler, stores and etc. you can use a startup function to register everything, this will help you to organize your project further.
Create a file in you project in my case i'll name it startup.ts
:
// startup.ts
import type Container from "@arashghafoori/mediator/container";
export default function startup(container: Container) {
// register everything here...
}
Then in the main - in my case main.ts
- file call the startup function:
// startup.ts
import { mediator } from "@arashghafoori/mediator";
import startup from "./startup";
startup(mediator);