Skip to content

Commit

Permalink
Merge pull request #5323 from bmac/vendor-prefix
Browse files Browse the repository at this point in the history
Stop using deprecated vendor-prefix hook to inject enableoptionalfeat…
  • Loading branch information
pangratz committed Jan 15, 2018
2 parents 0d99f76 + 2575b4a commit 90624a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/enable-optional-features-via-url/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@ module.exports = {
the flag to true when there is a `enableoptionalfeatures` query parameter.
*/
contentFor: function(name) {
if (name === "vendor-prefix") {
if (name === "enable-optional-features") {
var array = [
"<script>",
"// injected by lib/enable-optional-features-via-url",
"window.EmberENV = window.EmberENV || {};",
"if (typeof window.EmberENV.ENABLE_OPTIONAL_FEATURES === 'undefined') {",
" window.EmberENV.ENABLE_OPTIONAL_FEATURES = window.location.search.indexOf('enableoptionalfeatures') !== -1;",
"}"
"Object.defineProperty(window, 'EmberENV', {",
" get() {",
" if (typeof this._EmberENV.ENABLE_OPTIONAL_FEATURES === 'undefined') {",
" this._EmberENV.ENABLE_OPTIONAL_FEATURES = window.location.search.indexOf('enableoptionalfeatures') !== -1;",
" }",
" return this._EmberENV;",
" },",
" set(value) {",
" this._EmberENV = value;",
" }",
"});",
"</script>",
];

return array.join('\n');
Expand Down
1 change: 1 addition & 0 deletions tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<body>
{{content-for "body"}}
{{content-for "test-body"}}
{{content-for "enable-optional-features"}}

<script src="/testem.js" integrity=""></script>
<script src="{{rootURL}}assets/vendor.js"></script>
Expand Down

0 comments on commit 90624a3

Please sign in to comment.