CoreObject#reopen()

reopenpublic

Defined in packages/ember-runtime/lib/system/core_object.js:681

Augments a constructor's prototype with additional properties and functions:

MyObject = Ember.Object.extend({
  name: 'an object'
});

o = MyObject.create();
o.get('name'); // 'an object'

MyObject.reopen({
  say: function(msg){
    console.log(msg);
  }
})

o2 = MyObject.create();
o2.say("hello"); // logs "hello"

o.say("goodbye"); // logs "goodbye"

To add functions and properties to the constructor itself, see reopenClass

doc_EmberJs
2016-11-30 16:49:01
Comments
Leave a Comment

Please login to continue.