Skip to content

Instantly share code, notes, and snippets.

@zeppelin
Created June 1, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeppelin/2a9165df90bc130317304701620a4d58 to your computer and use it in GitHub Desktop.
Save zeppelin/2a9165df90bc130317304701620a4d58 to your computer and use it in GitHub Desktop.
import EmberObject from '@ember/object';
class SubclassWithEmberInit extends EmberObject {
someProp = 'value';
init() {
super.init(...arguments);
console.log(this.someProp); // undefined
// `this.someProp` will be available after initialization,
// just not from the `init` method...
}
}
class SubclassWithConstructor extends EmberObject {
someProp = 'value';
constructor() {
super(...arguments);
console.log(this.someProp); // "value"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment