Skip to content

Commit

Permalink
[RFC#706]: Deprecate window.Ember and window.Em, which is an alias
Browse files Browse the repository at this point in the history
of window.Ember

RFC: emberjs/rfcs#706

tl;dr: Recommend `import Ember from 'ember';` instead of using the window.Ember
global
  • Loading branch information
NullVoxPopuli committed Jan 27, 2021
1 parent 82f3089 commit bc14af2
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion packages/ember/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,35 @@ export default Ember;
if (IS_NODE) {
module.exports = Ember;
} else {
context.exports.Ember = context.exports.Em = Ember;
Object.defineProperty(context.exports, 'Ember', {
configurable: true,
writable: true,
get() {
deprecate(
"Using window.Ember has been deprecated. Use `import Ember from 'ember';` instead ",
false,
{
id: 'ember-source.window-global',
until: '4.0.0',
url: 'tbd',
for: 'ember-source',
since: { enabled: '3.26.0-beta.1' },
}
);

Object.defineProperty(context.exports, 'Ember', {
configurable: true,
writable: false,
get() {
return Ember;
},
});

return Ember;
},
});

context.exports.Em = context.exports.Ember;
}

/**
Expand Down

0 comments on commit bc14af2

Please sign in to comment.