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

[Question] Sharing state between logic #161

Closed
venkatd opened this issue Feb 28, 2024 · 2 comments
Closed

[Question] Sharing state between logic #161

venkatd opened this issue Feb 28, 2024 · 2 comments

Comments

@venkatd
Copy link

venkatd commented Feb 28, 2024

Hi! Looks like a very interesting library and was curious how you would handle accessing shared state in a logic.

For example, we might have a logic called organizationSettings that many other logics may want to access in actions, listeners, etc.

I have not yet given keajs a try so just asking conceptually :)

@Tbhesswebber
Copy link

I'm not a maintainer of Kea, although I have been using it a decent amount in side projects.

Connecting logics is where you really want to leverage connect. For logics that are expected to be consumed by other logics, I have started writing a custom logic builder to handle all of the necessary aspects of wiring up the logic. You can see this issue for an example: #160

@mariusandra
Copy link
Member

Hey @venkatd , indeed as Tanner wrote, you should look at the connect docs to learn more about connecting logics to share state. It should all work quite seamlessly. If the other logic is mounted, you can also access it directly with just otherLogic.values.something, but connecting is somewhat cleaner.

Closing this now. Feel free to comment and/or reopen if you have any followup questions.

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

3 participants