-
Notifications
You must be signed in to change notification settings - Fork 0
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
Svelte / Vue style two-way bindings. #4
Comments
On the first look:
Disadvantages / Questions
|
Currently it just registers Ev::Input and sets the appropriate attr! listed (i.e. normally At::Value). It updates the use_state accessor via .set() on the Ev::Input change argument. Only currently works if there is a Default NoOp, so compiler will at least complain if Msg has no default.
Yes so if At::Value was set independently there would be a clash not sure who seed decides which one wins. Maybe the last applied?
Currently would only work if custom element fired the Ev::Input event, however could allow for custom events via say
Yes.
Currently yes only updates state variable if parse suceeds. However probably need to 'revert' the At::Value if parse fails to keep both UI and state in sync.
True however this would only be for inputs which you dont want reaching your business logic. For instance maybe a number of individual inputs could be used to configure a "Search" struct. This would reach the app via a normal message |
My opinion - it looks interesting but also complex. And I think we don't have to modify Seed to use it (once Seed supports at least |
Svelte and some other frameworks use two way bindings to reduce boilerplate. Here is an example from Svelte's website:
We can mimic this in seed as per the below. Admittedly, it's not quite as concise but it does the job.
Is this something we want to see?
The text was updated successfully, but these errors were encountered: