Skip to content

Create injectable StateService #1

Open
@elf-pavlik

Description

@elf-pavlik

For now it can directly import StateActor from https://github.com/hackers4peace/reciprocity-tracker-state-actor later we can move it to Web Worker. Few notes

  • Only StateService knows about StateActor. StateService itself doesn't know anything about Redux used by StateActor, only knows format of messages (actions) sent to StateActor and format of State send from StateActor to UiActor.
  • It provides action creators to components that need it
  • It can practically copy action creators from https://github.com/elf-pavlik/agent-form/blob/wip/actions.ts just rename transaction to exchange and remove actions with actionTypes not included in state-actor repo. Actions use stateActorHandle(send) to send messages.
  • It provides observable state to components that need it
  • It can almost copy UiAgent from https://github.com/elf-pavlik/agent-form/blob/wip/UiActor.ts without any history management and connect onMessage to simply update the Observable state which components subscribe to directly.
  • StateActor includes TS interface definitions which components may need, they can import them directly from reciprocity-tracker-state-actor/lib/interfaces

ping @samurex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions