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

Listen for changes #1

Closed
manueldidonna opened this issue May 2, 2019 · 2 comments
Closed

Listen for changes #1

manueldidonna opened this issue May 2, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@manueldidonna
Copy link

I would listen for value changes as I do with android shared preferences. I haven't found a built in solution

@adrielcafe
Copy link
Owner

Hi @manueldidonna , thanks for your suggestion.

I intend to add a listener similar to shared preferences, I'm just waiting for some free time to work on that.

And of course, PRs are very welcome!

@adrielcafe adrielcafe added the enhancement New feature or request label May 6, 2019
@adrielcafe adrielcafe self-assigned this May 6, 2019
@manueldidonna
Copy link
Author

manueldidonna commented May 9, 2019

If you want I could make a PR with a simple listener and a rxjava implementation (I don't have enough experience with kotlin channel/flow). I'm using it and it works.

SharedPreferences uses weak references for listeners (it stores them in a WeakHashMap). I see that more as an hack than a solution, because we should keep in mind that a listener can stop listen at any moment when there is no reference to it anymore. So, personally, I believe we should avoid a listener with a non-deterministic existence

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

No branches or pull requests

2 participants