6
votes

I am refering to this particular deprecation that was introduced in Ember 1.12

lookup was called on a Registry. The initializer API no longer receives a container, and you should use an instanceInitializer to look up objects from the container

I looked at the guide, but I am unsure on how to fix this.

Here's a snippet of the code I have at the moment

initialize = (container, app) ->
  auth = container.lookup('auth-manager:main')

  local_config = ($.ajax
    type: 'GET'
    url: '/config.json'
    async:false
  ).responseJSON

  external_config = ($.ajax
    type: 'GET'
    url: local_config.crm.provisioning.url + '/v1/configurations'
    dataType: 'json'
    headers:
      'Authorization': auth.get 'token'
      'Accept': 'application/json'
      'Content-Type': 'application/json'
    async: false
    error: (e)->
      if e.status == 401
        window.location.href = window.location.origin + '/auth.html?src_url=' + window.location.href
  ).responseJSON

ConfigInitializer =
  name: 'config'
  after: 'auth-manager'
  initialize: initialize

The problem is that I require the auth-manager initializer in order to initialize my config initializer. Most of my other initializers require both the config and auth-manager initializers to get an access_token and connection endpoints.

In a ember-cli project should there be one file for the instance initializer and one for the registration of the initializer ?

The example given in the ember doc really confuses me.

1
I believe this info is coming on a future release. I noticed a conversation on github yesterday related to the documentation and generator logic. I'm just ignoring the init warnings until the smoke clears - especially since ember-data still is throwing them out.adammokan
@adammokan, could you please add the link to this conversation? Thanks!QuantumLicht

1 Answers

1
votes

I haven't hit this one yet, but hopefully this will lead somewhere useful. https://github.com/emberjs/ember.js/issues/10177