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

Request: FlowSettings for JS #139

Closed
sproctor opened this issue Feb 7, 2023 · 3 comments
Closed

Request: FlowSettings for JS #139

sproctor opened this issue Feb 7, 2023 · 3 comments

Comments

@sproctor
Copy link

sproctor commented Feb 7, 2023

I'm willing to take a first stab at this. My idea is to have an internal state to observe when a value changes. This wouldn't notice modification from an external source, but works for my use-case. Maybe an event listen can be used to watch for external changes, but I'm not familiar with that.

@russhwolf
Copy link
Owner

I've been reluctant to go with a solution that holds internal state at the Settings level, because it makes interop unintuitive, If you're interacting with your storage both from shared code and from the JS layer, you'd get inconsistent behavior.

Ideally it would be possible to use the event listener that exists for storage changes, but unfortunately it doesn't fire for events that are triggered from the same window. So it hasn't been clear to me what the best path forward is.

@sproctor
Copy link
Author

Makes sense. It's pretty simple to implement locally and then the behavior is obvious.

To implement in the library, maybe install a listener and require an annotation warning about it not observing changes to the storage object from a different context on the same page? I don't know if it's worthwhile, this is just an idea.

@russhwolf
Copy link
Owner

I'm going to close this because your proposed solution will be covered by #155

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

2 participants