-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [BUGFIX beta] Avoid using `Ember.lookup` to setup global. `Ember.lookup` is an internal mechanism used by older versions of Ember to "lookup" things on the global scope. In Ember 2.7 usage of `Ember.lookup` will be deprecated, so this removes our need for it. This also adds a deprecation when using the global `DS` (suggesting imports instead). * Explicitly name the namespace Since the DS namespace is not added to Ember.lookup anymore, the name for the namespace needs to be defined explicitly. * Disable the window.DS warning in the bower build
- Loading branch information
Showing
5 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* globals global, window, self */ | ||
|
||
// originally from https://github.com/emberjs/ember.js/blob/c0bd26639f50efd6a03ee5b87035fd200e313b8e/packages/ember-environment/lib/global.js | ||
|
||
// from lodash to catch fake globals | ||
function checkGlobal(value) { | ||
return (value && value.Object === Object) ? value : undefined; | ||
} | ||
|
||
// element ids can ruin global miss checks | ||
function checkElementIdShadowing(value) { | ||
return (value && value.nodeType === undefined) ? value : undefined; | ||
} | ||
|
||
// export real global | ||
export default checkGlobal(checkElementIdShadowing(typeof global === 'object' && global)) || | ||
checkGlobal(typeof self === 'object' && self) || | ||
checkGlobal(typeof window === 'object' && window) || | ||
new Function('return this')(); // eval outside of strict mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;(function() { | ||
var global = require('ember-data/-private/global').default; | ||
var DS = require('ember-data').default; | ||
Object.defineProperty(global, 'DS', { | ||
get: function() { | ||
return DS; | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters