Ember数据初始化顺序

时间:2014-02-11 17:02:05

标签: ember.js ember-data ember-app-kit

为什么在ember数据库中,在初始化期间,初始化程序'injectStore'在'store'初始化程序之前被调用(因此在存储被注册之前)?

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');
      ...

不应该,先注册然后注入?

1 个答案:

答案 0 :(得分:2)

请参阅Stefan Penner的that评论