-
Notifications
You must be signed in to change notification settings - Fork 31
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
Have a way to inject listeners into derived Store
implementation
#51
Comments
Great idea! Feel free to open a PR |
Am working on implementing this. However I've run into a bit of a problem - the code I posted above doesn't work - it seems like you can only have one listener for each
but I took that to mean that you can't register the same listener twice - not that you can only have one type of listener for each If it's not intended or you want it changed I can have a go but that's a slightly bigger job and might be a breaking change... |
Are you getting an error? You should definitely be able to have multiple types of listeners for one store |
No error. It's just the first listener is dropped when the second listener is registered. I believe it should be relatively easy to fix - just make |
That's definitely a bug! Yes you're correct, that would fix it. Feel free to include it in your PR, and maybe a unit test too? |
Hi. I love this crate - I use it in all my yew projects.
At the moment it's a bit of a pain to use listeners because I am almost always using the Derive attribute to implement
Store
and persist to local storage. If I want to add a listener to a Store with zero listeners I need to expand the macro and add theinit_listener
statements. This is a bit ugly and potentially error prone. It would be nice to have an attribute to initialize extra listeners in the generated code.For example you could write something like:
Instead of:
Happy to have a go and do a PR if you think this is a good idea.
The text was updated successfully, but these errors were encountered: