Hi, I’m having difficulties explaining the subtleties behind Ember’s actions API(s?). Between
{{my-component myAction="anAction"}}
{{my-component myAction=(action "anAction")}}
the difference is fairly simple: “Use the second form as it allows for better control” (return value, etc…).
But add to that the component’s syntax, with either:
-
this.attrs.anAction()
(which looks like an incidental feature) -
this.get('anAction')()
(which is ugly) -
this.sendAction('anAction')
(which does not benefit from closure actions goodness)
It’s very hard to give to newcomers a clear mental model of what they should do and how they should do it.
Add up that:
- this RFC that newcomers wouldn’t read rfcs/0050-improved-actions.md at master · emberjs/rfcs · GitHub
- GitHub - DockYard/ember-route-action-helper: Bubble closure actions in routes
- and mostly https://github.com/martndemus/ember-invoke-action
and you are in for a very confusing training session.
So, I wanted to ask if there were established best practices (beyond Triggering Changes with Actions - Components - Ember Guides) and/or a definitive guide and/or a definitive addon.
If someone had an addon as useful to the actions as ember-native-dom-helpers
is useful to testing, I’d be eternally (yes, eternally!) grateful!
All the best to you all, dear Embereñas y Embereños!