Skip to content

Commit

Permalink
Merge pull request #16710 from bekzod/remove-name-key
Browse files Browse the repository at this point in the history
add deprecation to `NAME_KEY`
  • Loading branch information
rwjblue committed Dec 19, 2018
2 parents 25c9945 + 914f3cc commit 1032b80
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 13 additions & 1 deletion packages/ember/index.js
Expand Up @@ -190,7 +190,19 @@ Ember.canInvoke = utils.canInvoke;
Ember.tryInvoke = utils.tryInvoke;
Ember.wrap = utils.wrap;
Ember.uuid = utils.uuid;
Ember.NAME_KEY = utils.NAME_KEY;

Object.defineProperty(Ember, 'NAME_KEY', {
enumerable: false,
get() {
deprecate('Using `Ember.NAME_KEY` is deprecated, override `.toString` instead', false, {
id: 'ember-name-key-usage',
until: '3.9.0',
});

return utils.NAME_KEY;
},
});

Ember._Cache = utils.Cache;

// ****@ember/-internals/container****
Expand Down
7 changes: 6 additions & 1 deletion packages/ember/tests/reexports_test.js
Expand Up @@ -34,6 +34,12 @@ moduleFor(
}, /EXTEND_PROTOTYPES is deprecated/);
}

['@test Ember.NAME_KEY is deprecated']() {
expectDeprecation(() => {
Ember.NAME_KEY;
}, 'Using `Ember.NAME_KEY` is deprecated, override `.toString` instead');
}

'@test Ember.FEATURES is exported'(assert) {
for (let feature in FEATURES) {
assert.equal(
Expand Down Expand Up @@ -65,7 +71,6 @@ let allExports = [
['canInvoke', '@ember/-internals/utils'],
['tryInvoke', '@ember/-internals/utils'],
['wrap', '@ember/-internals/utils'],
['NAME_KEY', '@ember/-internals/utils'],

// @ember/-internals/container
['Registry', '@ember/-internals/container', 'Registry'],
Expand Down

0 comments on commit 1032b80

Please sign in to comment.