3

为什么在 ember 数据库中,在初始化期间,初始化程序 'injectStore' 在 'store' 初始化程序之前被调用(所以在 store 被 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');
      ...

不应该,先注册后注入?

4

1 回答 1

2

请参阅Stefan Penner的评论

于 2014-02-11T17:16:32.740 回答