Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create injectable StateService #1

Open
elf-pavlik opened this issue May 16, 2019 · 0 comments
Open

Create injectable StateService #1

elf-pavlik opened this issue May 16, 2019 · 0 comments

Comments

@elf-pavlik
Copy link
Member

elf-pavlik commented May 16, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant