Skip to content

MobX code blocks working by start\stop mechanism

License

Notifications You must be signed in to change notification settings

js2me/mobx-process

Repository files navigation

logo

mobx-process

NPM version test status build status npm download bundle size

MobX code blocks working by start\stop mechanism

Main goal which these "processes" are needed is the executing some business logic across whole application. Naming "process" was borrowed from FSD architectural methodology. More about this idea of this process implementation you can read here

Usage

1. Create instance of the ProcessStore

You can create your own implementation or use ready from package.

import { ProcessStoreImpl } from "mobx-process";

const processStore = new ProcessStoreImpl();

2. Create implementation of the Process

Or you can use ready from package.

import { Process, ProcessImpl } from "mobx-process";

export class MyProcess extends ProcessImpl implements Process {
  childProcesses = [];

  async start() {
    // do some logic
    await super.start();
  }

  async stop() {
    await super.stop();
  }
}

3. Load process into store

await processStore.load(MyProcess)

About

MobX code blocks working by start\stop mechanism

Resources

License

Stars

Watchers

Forks

Packages

No packages published