-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Expose all contained Bindings via View interface #373
Comments
Could you elaborate this? What View type and what would you rather do? The code you are having should work great, and should not break in future. About an official method, I guess it's not too bad to have a method to recursively walk and gather all bindings into an array. cc @EisenbergEffect and @fkleuver |
Beside that, is this appropriate to say it's quite specific to form in general, and could be easily done via
|
The functionality you're implementing in Now, you're asking for an official API to get all bindings from a view, but isn't deep observation with dirty state tracking what you're really looking for? We do kind of already have this, it's I don't see any real issues with exposing an official API for getting all bindings but for me, the necessity of doing that in the first place is indicative of either some other higher level API missing in the framework, or the user not being aware of certain features already existing in other API's. Apart from deep observation with state tracking, I honestly can't really imagine a use case for retrieving all bindings. There are also other extension points (e.g. So before we consider further increasing the API surface in vCurrent please let me know what you think about any of the above. Have you tried / considered trying store and/or |
Hi,
This is great feedback and you are right. I am new to Aurelia and as such I
am not aware of all the features Aurelia brings to the table.
I had heard of Aurelia store but dismissed it because it seemed like
overkill at first. But, I will take a better look at it. What I have not
seen yet is the extensionpoint processAttribute. This is certainly worth a
look as well. Also, the previous answer to my question by Bigopon
suggesting traversing the dom for input-elements and retrieve the
corresponding bindingins that way is something I will take a look at.
Thanks you guys for the input. I appreciate it.
…On Mon, Apr 22, 2019 at 12:52 AM Fred Kleuver ***@***.***> wrote:
@HubertoKusters <https://github.com/HubertoKusters>
The functionality you're implementing in attached() and detached() is
normally what you do in bind() and unbind() of a binding behavior. But
you don't want to put the same binding behavior on every single binding in
a view, that's just messy, so you grab all the bindings via a custom
attribute and apply the functionality like that. It makes perfect sense.
Now, you're asking for an official API to get all bindings from a view,
but isn't deep observation with dirty state tracking what you're really
looking for?
I have solved a very similar problem in a few instances before, also for
enabling/disabling save and undo buttons etc. I (and I'm sure others as
well) would prefer an official API for actually solving *that* problem.
We do kind of already have this, it's aurelia-store. From an
architectural point of view that's probably going to give you the cleanest
and most robust way of accomplishing this.
I don't see any real issues with exposing an official API for getting all
bindings but for me, the necessity of doing that in the first place is
indicative of either some other higher level API missing in the framework,
or the user not being aware of certain features already existing in other
API's.
Apart from deep observation with state tracking, I honestly can't really
imagine a use case for retrieving all bindings. There are also other
extension points (e.g. processAttributes) that allow bulk-modifying
bindings without the need to traverse like this.
So before we consider further increasing the API surface in vCurrent
please let me know what you think about any of the above. Have you tried /
considered trying store and/or @processAttributes? Do they miss anything?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#373 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABRMEDMKPES3ZHMXMDAVYKTPRTV2DANCNFSM4HGFYHRA>
.
|
I'm submitting a feature request
1.8.0
Please tell us about your environment:
Operating System:
Windows 7
Node Version:
10.8.0
NPM Version:
6.9.0
JSPM OR Webpack AND Version
webpack 4.29.6
Browser:
Chrome Version 73.0.3683.103 (Official Build) (64-bit)
Language:
TypeScript 3.4.3
Current behavior:
View interface does not expose a method to get all contained bindings
Expected/desired behavior:
A method added to the View interface to access all contained bindings
What is the expected behavior?
A method added to the View interface to access all contained bindings
What is the motivation / use case for changing the behavior?
I have created a custom attribute to monitor if binding values have changed. This is useful for activating certain form elements (like save-button) when changes have been made by the use.
Below you find the code:
This works great, however the main problem I have with this code is located in the getBindings function:
This function has to dig too deep into the internals of Aurelia and as a result, this might fail some day. Furthermore, due to the fact I have to dig so deep I cannot make use of the View type, which I rather did.
So, my question is: could such information be exposed via an official interface method in View?
Any thoughts?
TIA
The text was updated successfully, but these errors were encountered: