-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
Add inject service RFC #752
Conversation
This may seem like a good idea in isolation, but it breaks down a bit in the greater context. A couple of immediate issues that I can see with directly renaming
I have had some apps I've worked on where both |
I don't think this'll cause confusion I'm in favor of this RFC -- a very much don't like renaming the import as a default for convention's sake. It'd be fantastic to just import |
though, it might make more sense to have import { service } from '@ember/application'; |
Personally, I think that decorators should describe what they provide, not how they provide it. I also don't think the overlap between injecting controllers and services should matter much. Controllers will eventually be deprecated, along with controller injections, so we should be focusing on the future of dependency injection without them, which will likely consist of only services. |
@kpfefferle a couple notes in response here:
|
I personally have always been using import Service, { service } from '@ember/service'; when I needed another service inside of a service and never found it confusing. I also never inject controllers, I just notice it every time I type |
This was discussed at today's framework team meeting and we think this is ready for Final Comment Period! |
I've pushed a notable update here. It:
|
Thank you!!! |
Thanks for working on this RFC! I'm happy to see it merged. With regards to addon interoperability with older Ember versions, I was wondering whether we could provide a polyfill instead of requiring addon authors to spell out: import * as ES from '@ember/service';
const service = ES.service ?? ES.inject; In old globals-resolver-based apps we could probably leverage |
I see a bunch of comments in here about deprecating controller injections and just wanted to share #574 again. Feel free to resurrect. |
This adds a Babel plugin which renames `service` imports to `inject` if the current Ember version doesn't support this import yet. This is a polyfill for RFC 752. More information can be found in the RFC PR: emberjs/rfcs#752
This adds a Babel plugin which renames `service` imports to `inject` if the current Ember version doesn't support this import yet. This is a polyfill for RFC 752. More information can be found in the RFC PR: emberjs/rfcs#752
This adds a Babel plugin which renames `service` imports to `inject` if the current Ember version doesn't support this import yet. This is a polyfill for RFC 752. More information can be found in the RFC PR: emberjs/rfcs#752
Rendered