Skip to content
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

Merged
merged 1 commit into from
Apr 2, 2015

Conversation

bmac
Copy link
Member

@bmac bmac commented Apr 2, 2015

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.

@@ -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;
Copy link
Member

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;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Copy link
Member Author

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.
@rwjblue
Copy link
Member

rwjblue commented Apr 2, 2015

LGTM

@dgeb - Any objections?

@dgeb
Copy link
Member

dgeb commented Apr 2, 2015

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.

dgeb added a commit that referenced this pull request Apr 2, 2015
Register some built in Ember Data objects if ED exists on the page.
@dgeb dgeb merged commit 0d54eb5 into emberjs:master Apr 2, 2015
@bmac bmac deleted the register-ed-objects branch April 2, 2015 17:00
@rwjblue
Copy link
Member

rwjblue commented Apr 2, 2015

Thanks @dgeb! Also, I am really getting tired of the whack-a-mole here, and definitely am looking forward to your RFC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants