smfoote / ember-glimmer-component

Glimmer.js-like components in Ember
MIT License
9 stars 0 forks source link

Available APIs #2

Open knownasilya opened 6 years ago

knownasilya commented 6 years ago

Looking at the code for the component manager, it doesn't seem like the component (non compat) has any of the Glimmer.js component functionality. So no hooks or computed properties, basically pass through args and maybe actions? Could you clarify what feature can be used and how to use actions (is the bind helper needed)?

smfoote commented 6 years ago

Currently, the following hooks are available:

Computed properties are only available in the CompatComponent, because it extends EmberObject. I believe @tracked, which is now available in Canary (see this merged PR), should be usable for ES6 Components, but I haven't tested it yet, so I can't say for sure yet.

Actions in the CompatComponent work just like Ember components; they need to be in the actions property. Actions in the ES6 class Component should just be added as properties on the class. For example, see the hello-world component (class and template) in the dummy app.