-
-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register some built in Ember Data objects if ED exists on the page. #33
Conversation
@@ -66,6 +66,18 @@ export default function isolatedContainer(fullNames) { | |||
container.register('view:select', Ember.Select); | |||
container.register('route:basic', Ember.Route, { instantiate: false }); | |||
|
|||
var global = typeof global === 'object' && global || window; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because var global
is hoisted, I don't think you can make this typeof global
check it should work if you choose a different local variable name though. Also, self
should be used instead of window
(as it works in WebWorkers and normal browser scenarios, but window
does not work in WebWorkers).
I'm thinking of something like:
var globalContext = typeof global === 'object' && global || self;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated thanks for the feedback.
This will make it easier to test serializers without having to know about the transform's Ember Data registers under the hood.
69371c4
to
7d22886
Compare
LGTM @dgeb - Any objections? |
I could live with this for now, but it just highlights how backwards our isolatedContainer implementation is now. We should straighten this out before ember 2.0. I've promised an Ember RFC on containers / registries and will take this into account. In the mean time, I will merge. |
Register some built in Ember Data objects if ED exists on the page.
Thanks @dgeb! Also, I am really getting tired of the whack-a-mole here, and definitely am looking forward to your RFC. |
This will make it easier to test serializers without having to know
about the transform's Ember Data registers under the hood.
Not sure the best way to test this without adding Ember Data as a dependency.