Function

reopen public

Module: @ember/object

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

import EmberObject from '@ember/object';

const MyObject = EmberObject.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/3.25/functions/@ember%2Fobject/reopen