{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/11440","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/11440/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/11440/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/11440/events","html_url":"https://github.com/emberjs/ember.js/pull/11440","id":88085709,"number":11440,"title":"Container / Registry Reform","user":{"login":"dgeb","id":29122,"avatar_url":"https://avatars.githubusercontent.com/u/29122?v=3","gravatar_id":"","url":"https://api.github.com/users/dgeb","html_url":"https://github.com/dgeb","followers_url":"https://api.github.com/users/dgeb/followers","following_url":"https://api.github.com/users/dgeb/following{/other_user}","gists_url":"https://api.github.com/users/dgeb/gists{/gist_id}","starred_url":"https://api.github.com/users/dgeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgeb/subscriptions","organizations_url":"https://api.github.com/users/dgeb/orgs","repos_url":"https://api.github.com/users/dgeb/repos","events_url":"https://api.github.com/users/dgeb/events{/privacy}","received_events_url":"https://api.github.com/users/dgeb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-06-13T23:51:24Z","updated_at":"2015-07-16T17:39:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/emberjs/ember.js/pulls/11440","html_url":"https://github.com/emberjs/ember.js/pull/11440","diff_url":"https://github.com/emberjs/ember.js/pull/11440.diff","patch_url":"https://github.com/emberjs/ember.js/pull/11440.patch"},"body":"This is an implementation of [RFC 46](https://github.com/emberjs/rfcs/pull/46). The goal is to fully encapsulate and privatize the `Container` and `Registry` classes by exposing a select subset of public methods on `Application` and `ApplicationInstance`.\r\n\r\nThis is achieved by introducing two new proxy mixins: `RegistryProxy` and `ContainerProxy`.\r\n\r\n`Application` now mixes in `RegistryProxy`.\r\n\r\n`ApplicationInstance` mixes in both `RegistryProxy` and `ContainerProxy`.\r\n\r\n## RegistryProxy\r\n\r\n`RegistryProxy` maintains the registry as a private `__registry__` property.\r\n\r\nThe following registry methods are exposed publicly via `RegistryProxy`:\r\n\r\n* `resolveRegistration` - alias for `resolve`\r\n* `register`\r\n* `unregister`\r\n* `hasRegistration` - alias for `has`\r\n* `registerOption` - alias for `option`\r\n* `registerOptions` - alias for `options`\r\n* `registeredOptions` - alias for `getOptions`\r\n* `registerOptionsForType` - alias for `optionsForType`\r\n* `registeredOptionsForType` - alias for `getOptionsForType`\r\n* `inject` - alias for `injection`\r\n\r\n## ContainerProxy\r\n\r\n`ContainerProxy` maintains the container as a private `__container__` property.\r\n\r\nThe following container methods are exposed publicly via `ContainerProxy`:\r\n\r\n* `lookup`\r\n* `lookupFactory`\r\n\r\n## Privatization of Container and Registry\r\n\r\nThe introduction of these interfaces allows for the complete privatization of the `Container` and `Registry` classes. This allows for their architecture and documentation to be cleaned up. For instance, a `Container` can freely reference its associated `Registry` as `registry` rather than `_registry`, as it can be assumed that only framework developers will reference this property.\r\n\r\n## Simplification of Initializers\r\n\r\n`Application` initializers now receive a single argument to `initialize`: `application`. Receiving two arguments is still allowed, but deprecated.\r\n\r\nLikewise, `ApplicationInstance` initializers still receive a single argument to `initialize`: `applicationInstance`.\r\n\r\n## Allow Application Instance's Registrations to take Precedence over the Resolver\r\n\r\nThis work also addresses #11174 by only associating a resolver with the `Application`'s registry and not with `ApplicationInstance`'s registry.\r\n\r\nThis has a couple benefits:\r\n\r\n* It allows registrations made in the app instance's registry to be resolved before falling back to the app's registry, rather than hitting the resolver beforehand. This is important for scenarios such as testing in which custom registrations need to take precedence over the resolver.\r\n\r\n* It is also more efficient in the case when the app's registry's registrations are used to resolve, because it avoids calling the same resolver twice before finally getting the registration.\r\n"},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/122031560","html_url":"https://github.com/emberjs/ember.js/pull/11440#issuecomment-122031560","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/11440","id":122031560,"user":{"login":"rwjblue","id":12637,"avatar_url":"https://avatars.githubusercontent.com/u/12637?v=3","gravatar_id":"","url":"https://api.github.com/users/rwjblue","html_url":"https://github.com/rwjblue","followers_url":"https://api.github.com/users/rwjblue/followers","following_url":"https://api.github.com/users/rwjblue/following{/other_user}","gists_url":"https://api.github.com/users/rwjblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rwjblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwjblue/subscriptions","organizations_url":"https://api.github.com/users/rwjblue/orgs","repos_url":"https://api.github.com/users/rwjblue/repos","events_url":"https://api.github.com/users/rwjblue/events{/privacy}","received_events_url":"https://api.github.com/users/rwjblue/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T17:39:31Z","updated_at":"2015-07-16T17:39:31Z","body":"The old-jquery build was a spurious failure, I restarted and it is passing now.\r\n\r\nThe node-tests build is a legit failure, you need to update https://github.com/emberjs/ember.js/blob/master/tests/node/app-boot-test.js#L97 to use `app.register` instead of `app.registry.register` (I think)."}}