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

ember-cli-addon - split initializer #564

Merged

Conversation

Jakeii
Copy link
Contributor

@Jakeii Jakeii commented Jun 22, 2015

Hopefully this should be the last of the initializer pulls! Targets the ember-cli-addon branch.

As per emberjs/ember.js#10256 (comment), it no longer relies on deferRediness, and incorporates most of the setup into the ApplicationRouteMixin.beforeModel method.

The initializer now only registers the stores/session, and instanceInitializer now only injects session into components, controllers, routes.

}
setup(this.container).finally(() => {
this._super(transition);
if (!this.get('_authEventListenersAssigned')) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this still necessary then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, no need to check if listeners are assigned as ApplicationRoute.beforeModel is only called once per page load.

@marcoow marcoow added this to the 1.0 milestone Jun 23, 2015
@Jakeii Jakeii force-pushed the ember-cli-addon-initializer-rework branch from 9bf272f to a8c5dce Compare June 23, 2015 10:05
@Jakeii
Copy link
Contributor Author

Jakeii commented Jun 23, 2015

The ApplicationRouteMixin could be deprecated in favour of using reopen in the instance initializer to start setup and add the actions.

@marcoow
Copy link
Member

marcoow commented Jun 23, 2015

It would definitely be cool to deprecate the ApplicationRouteMixin but I don't think making reopen the "official" way to get along without it is great - there should be a cleaner solution.

@Jakeii
Copy link
Contributor Author

Jakeii commented Jun 30, 2015

Whats wrong with reopen? it's not a hack, it's used internally within Ember and referenced in the official guide and API docs.

as ApplicationRoute.beforeModel is only called once per page load.
@marcoow
Copy link
Member

marcoow commented Jul 3, 2015

It's basically the same as monkey patching in Ruby - it's very powerful and makes a lot of things very simple in the first place. At the same time though if used heavily it complicates stuff as you might be looking at some method that might be overridden somewhere else and then you wonder why it doesn't behave the way it should by looking at the original source code.

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

Successfully merging this pull request may close these issues.

2 participants