@cmmn/domain
TypeScript icon, indicating that this package has built-in type declarations

2.2.3 • Public • Published

Domain level libraries

Domain is a part of application, that contains business-logic and core behaviour of app

Its isolated from UI and App levels and can be accessed through api

It can be located in WebWorker, SharedWorker, ServiceWorker or in a main thread

Logic and data should be located in reach-models with State getters and setters and Actions

In app level you can access ModelProxy

App connects to domain through some stream that serializes all data, actions and requests with serialization from core package.

  • Model
    • Is using for describe a single Entity in your work domain
    • Contains $state - a cell that changes on every model change and contains all usefull info about it, but not more.
    • Contains Actions that can be used to change a model
    • It can contains sub-models, that can be resolved relatively
  • ModelProxy
    • It lays in a main thread
    • It corresponds to some model in domain
    • It also has $state and Actions
    • $state can be local or remote: if you change it in local thread it will be local until any disturbance in main-worker communication will be finished and stable remote state will come.
    • It can have sub-model-proxies with same resolution as in models
  • Entrypoint
    • useDomain: you will get Model instead of ModelProxy.
    • useStreamDomain: you will get ModelProxy linked to a Model directly
    • useWorkerDomain: you will get ModelProxy linked to a Model via worker messages

Readme

Keywords

none

Package Sidebar

Install

npm i @cmmn/domain

Weekly Downloads

3

Version

2.2.3

License

ISC

Unpacked Size

1.46 MB

Total Files

64

Last publish

Collaborators

  • fransua.ne