Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Latest commit

 

History

History
43 lines (38 loc) · 662 Bytes

closure-actions.md

File metadata and controls

43 lines (38 loc) · 662 Bytes

Closure Actions

Rule name: closure-actions

Always use closure actions (according to DDAU convention). Exception: only when you need bubbling.

export default Controller.extend({
  actions: {
    detonate() {
      alert('Kabooom');
    }
  }
});
{{! GOOD }}
{{pretty-component boom=(action 'detonate')}}
export default Component.extend({
  actions: {
    pushLever() {
      get(this, 'boom')();
    }
  }
})
{{! BAD }}
{{awful-component detonate='detonate'}}
export default Component.extend({
  actions: {
    pushLever() {
      this.sendAction('detonate');
    }
  }
})