Skip to content
This repository has been archived by the owner on May 26, 2019. It is now read-only.

Remove explicit names from initializers. #1654

Merged
merged 2 commits into from
Jan 16, 2018
Merged

Remove explicit names from initializers. #1654

merged 2 commits into from
Jan 16, 2018

Conversation

eventualbuddha
Copy link
Contributor

Since ember-load-initializers already adds names to initializers based on the filename, we should not bother specifying them in the initializer files themselves. This brings initializers more in-line with how helpers are handled. This commit also makes better use of ES2015 features.

@@ -34,8 +34,7 @@ export function initialize(application) {
};

export default {
name: 'shopping-cart',
initialize: initialize
initialize
Copy link
Contributor

@locks locks Sep 19, 2016

Choose a reason for hiding this comment

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

I would one-liner this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it like this because it's fairly common to add before and after and I wanted to maintain symmetry. I can change it though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just wanted to say you were right, it was a better idea to keep it multiline ;)

@@ -51,13 +50,12 @@ Let's add some simple logging to indicate that the instance has booted:

```app/instance-initializers/logger.js
export function initialize(applicationInstance) {
var logger = applicationInstance.lookup('logger:main');
let logger = applicationInstance.lookup('logger:main');
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

logger.log('Hello from the instance initializer!');
}

export default {
name: 'logger',
initialize: initialize
initialize
Copy link
Contributor

Choose a reason for hiding this comment

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

one-liner as above?

@rwjblue
Copy link
Member

rwjblue commented Oct 27, 2016

@stefanpenner - Any objections?

@kellyselden
Copy link
Member

I'm cool with this change.

@homu
Copy link
Contributor

homu commented Jan 10, 2017

☔ The latest upstream changes (presumably #1766) made this pull request unmergeable. Please resolve the merge conflicts.

@eventualbuddha
Copy link
Contributor Author

I don't have time to work on this right now, but I believe the maintainers have edit access for this branch.

@@ -34,8 +34,7 @@ export function initialize(application) {
};

export default {
name: 'shopping-cart',
initialize: initialize
initialize
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wanted to say you were right, it was a better idea to keep it multiline ;)

@locks locks self-assigned this Apr 22, 2017
@locks
Copy link
Contributor

locks commented May 23, 2017

NOTE ONLY MERGE WHEN emberjs/ember.js#14338 IS IN A RELEASE

@locks locks modified the milestones: 2.15, Future Aug 17, 2017
@rwjblue
Copy link
Member

rwjblue commented Jan 16, 2018

This was released in ember-source@2.15

eventualbuddha and others added 2 commits January 16, 2018 14:16
Since ember-load-initializers already adds names to initializers based on the filename, we should not bother specifying them in the initializer files themselves. This brings initializers more in-line with how helpers are handled. This commit also makes better use of ES2015 features.

https://github.com/ember-cli/ember-load-initializers/blob/7ebe1d308cbbbfc3e6566cd05699e9a36fb7bddb/addon/index.js#L19-L20
@locks locks merged commit e7e810f into emberjs:master Jan 16, 2018
@locks
Copy link
Contributor

locks commented Jan 16, 2018

Thanks @eventualbuddha, sorry for letting it slide for so long 😅 .

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

Successfully merging this pull request may close these issues.

5 participants