On this page
Function
reopen public
Module: | @ember/object |
---|
Defined in packages/ember-runtime/lib/system/core_object.js:715
Augments a constructor's prototype with additional properties and functions:
const MyObject = Ember.Object.extend({
name: 'an object'
});
o = MyObject.create();
o.get('name'); // 'an object'
MyObject.reopen({
say(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
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fobject/reopen