2014-02-11 56 views
3

爲什麼在初始化過程中,初始化過程中初始化程序'injectStore'在'store'初始化程序之前被調用(所以在store被註冊之前)爲什麼在ember數據庫中?Ember數據初始化程序的訂單

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

不應,先登記後注入?

回答

2

that評論從斯特凡·彭納

+0

這正是我一直在尋找!謝謝 – bugman