initpublic
An overridable method called when objects are instantiated. By default, does nothing unless it is overridden during class definition.
Example:
1 2 3 4 5 6 7 8 9 10 11 | App.Person = Ember.Object.extend({ init: function () { alert( 'Name is ' + this .get( 'name' )); } }); var steve = App.Person.create({ name: "Steve" }); // alerts 'Name is Steve'. |
NOTE: If you do override init
for a framework class like Ember.View
, be sure to call this._super(...arguments)
in your init
declaration! If you don't, Ember may not have an opportunity to do important setup work, and you'll see strange behavior in your application.
Please login to continue.