Uh oh!
There was an error while loading. Please reload this page.
Element Modifiers - #112
Conversation
rwjblue
commented
Jan 24, 2016
This looks good, thanks for taking the time to put it together. I have a few thoughts/questions:
Again, great job on this, and thank you for pushing this forward! |
rwjblue
commented
Jan 24, 2016
We should also detail how this interacts with angle bracket components.
|
chadhietala
commented
Jan 26, 2016
I'm wondering if there is value in giving well defined and dependent hooks. My worry is around the higher potential of memory leaks being introduced into a project. If you had hooks like lethasListener=!!element.setupListeners;lethasRemoveListener=!!element.teardownListeners;assert(`You setup an event listener on ${element.toString()}, but did not tear it down in `teardownListeners`. If you are not setting up a listener please use another hook.`,component.setupListeners&&!hasRemoveListener) |
mmun
commented
Jan 27, 2016
Totally an aside, but I hope if we ever have a helper like |
cibernox
commented
Jan 27, 2016
Mixing existing ideas (the global dispatcher) with this approach, this would solve the problem that Something like could use Ember's global dispatcher and avoid adding/removing loads of event handlers if the collection changes? |
tchak
commented
Jan 27, 2016
In pre 2.0 lots of confusion was coming from the fact that Ember had way too much "primitives". I was hoping we were on the right path with components only in 2.0. But we introduced state full helpers and now this. This is not a complaint out of nowhere - I already found myself in situations where I had to explain to some people how a state full helper is different from a component... Feels like explaining how a view is different form a component in 1.0... I understand that there is a problem to be solved here, but I feel that this will extend api surface in the area where it is already pretty large. |
cibernox
commented
Jan 27, 2016
To some extent I feel the same way than @tchak about this, and I wonder if there is any way of unify helpers with this. I understand that there is a API gap that has to be filled. Some sort of helpers with access to the DOM of the element they are invoked in. Perhaps just a stateful helper that happens to have lifecycle hooks other than I don't know if can be considered having less primitives, because it's basically adding more capabilities to one existing primitive. Something that I like is the fact that this would remove the dicotomy of
It would formalize an existing magic in ember. |
jgwhite
commented
Jan 27, 2016
Thanks @mixonic, this is excellent. From an addon-author’s point of view, I would love to move the API for ember-sortable towards something like: Note the assumed availability of yielding contextual-element-modifiers. Did you see that as being a possibility? |
There was a problem hiding this comment.
what is the use case for this with an element modifier? I was thinking these would be scope to didInsertElement and willDestroyElement
stefanpenner
commented
Jan 29, 2016
Am I correct in assuming these are isomorphic to decorators, maybe a class decorator if one assumes each element is a class (for this discussion) |
krisselden
commented
Jan 29, 2016
Should this have a |
mixonic
commented
Feb 8, 2016
Thanks for the early feedback all. I'm still digesting but will take a pass at improvements soon. From @rwjblue:
To me, this is the most concerning comment. The proposal as it stands leans heavily on the API of components, with the goal not introducing a new set of hook names when they already largely match components. Using |
@taras I'm still very much in favor of completing an RFC for this feature, though the implementation is indeed very likely blocked on Glimmer 2. The API design is somewhat intertwined with that of Glimmer components, since I would like the way attrs are passed to match the Glimmer component API. For example this seems plausible: Roughly:
Again some of this is directly related to what APIs we design for Glimmer components, so I'll need to coordinate w/ @wycats and others to get consensus. I'm eager to take another pass :-) |
knownasilya
commented
Sep 8, 2016
Looking forward to some of this picking up now that Glimmer2 has basically landed. |
Fix noodle example
cibernox
commented
Sep 12, 2017
This is also something I find interesting and it's a shame it has been staled for a year. Was it abandoned for specific reasons? |
Probably the priorities have been diverted, but this seems like an important topic, especially for glimmer.js and it's custom elements story. It should work its way upstream I think. |
mixonic
commented
Sep 12, 2017
I think progress on this is again tractable. The biggest blocker is the API for how to access positional and named arguments inside the modifier. The hooks should be normalized to match those on Glimmer components. I'm wary of trying to push it forward before closing up the namespaces/addon support for module unification, re: my own time management 😬 |
mixonic
commented
Mar 2, 2019
Long belated: Closing this in favor of #353 |
Rendered