3
votes

Why in ember data library, during the initialization, the initializer 'injectStore' is called before the 'store' initializer (so before store has been regitered)?

https://github.com/emberjs/data/blob/master/packages/ember-data/lib/initializers.js#L49

Ember.onLoad('Ember.Application', function(Application) {
  Application.initializer({
  name: "store",

  initialize: function(container, application) {
    application.register('store:main', application.Store || DS.Store);

    ...

--

https://github.com/emberjs/data/blob/master/packages/ember-data/lib/initializers.js#L97

  Application.initializer({
    name: "injectStore",
    before: "store",

    initialize: function(container, application) {
      application.inject('controller', 'store', 'store:main');
      application.inject('route', 'store', 'store:main');
      ...

Shouldn't be, register first and inject after?

1

1 Answers

2
votes

See that comment from Stefan Penner