Function

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
18
19
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