Skip to content

Latest commit

 

History

History
47 lines (40 loc) · 695 Bytes

File metadata and controls

47 lines (40 loc) · 695 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')}}
// pretty-component.js
export default Component.extend({
  actions: {
    pushLever() {
      this.boom();
    }
  }
})

BAD

{{awful-component detonate='detonate'}}
// awful-component.js
export default Component.extend({
  actions: {
    pushLever() {
      this.sendAction('detonate');
    }
  }
})