Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.02 KB

getting-started.md

File metadata and controls

52 lines (34 loc) · 1.02 KB

Getting started

Follow this to get started and use mediator easily.


Table of Contents


Installation

To install mediator and get started use:

npm install @arashghafoori/mediator

Do you need a startup.ts?

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);