CoreObject#reopen()

reopenpublic

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.