Skip to content

Instantly share code, notes, and snippets.

@ksol
Created January 12, 2015 15:15
Show Gist options
  • Select an option

  • Save ksol/4f75753d68ea18243daf to your computer and use it in GitHub Desktop.

Select an option

Save ksol/4f75753d68ea18243daf to your computer and use it in GitHub Desktop.
// Do not do this
var SomeController = Ember.ArrayController.extend({
init: function() {
this._super.apply(this, arguments) // easy to forget, can introduce typos, etc
// your code here
}
});
// Do this
var SomeController = Ember.ArrayController.extend({
// The name of the function and the observing make the intent clearer
// than the code above, and it can be reused if needed.
// Also, less chances to do something wrong.
somethingOnInit: function() {
// your code here
}.on('init')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment