Skip to content

Commit

Permalink
Deprecate window.ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
astronomersiva committed Oct 1, 2019
1 parent 8481adf commit a5bf63e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/@ember/-internals/environment/lib/env.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { deprecate } from '@ember/debug';
import { FUNCTION_PROTOTYPE_EXTENSIONS } from '@ember/deprecated-features';
import { DEBUG } from '@glimmer/env';
import global from './global';
Expand Down Expand Up @@ -182,6 +183,20 @@ export const ENV = {
},
};

let providedEnv = global.EmberENV;
if (providedEnv === undefined) {
providedEnv = global.ENV;

deprecate(
"Configuring Ember's boot options via `window.ENV` is deprecated, please migrate to `window.EmberENV` instead.",
providedEnv === undefined,
{
id: 'ember-environment.window.env',
until: '3.17.0',
}
);
}

(EmberENV => {
if (typeof EmberENV !== 'object' || EmberENV === null) return;

Expand Down Expand Up @@ -241,7 +256,7 @@ export const ENV = {
if (DEBUG) {
ENV._DEBUG_RENDER_TREE = true;
}
})(global.EmberENV || global.ENV);
})(providedEnv);

export function getENV() {
return ENV;
Expand Down

0 comments on commit a5bf63e

Please sign in to comment.