Asked By: Anonymous
I can’t seem to figure out the difference between the two. The only difference I could see from the example is if somehow two instances of the application were running? How is that even possible?
Would someone be able to explain the difference between the two, and maybe with an example? I can’t seem to wrap my head around the documentation: https://guides.emberjs.com/v2.6.0/applications/initializers/
As for what I’m doing. I’m attempting to create a NotificationFactory so anyservice/util/component can create a defined Notification.
Solution
Answered By: Anonymous
Application initializers are run as your application boots, and
provide the primary means to configure dependency injections in your
application.Application instance initializers are run as an application instance
is loaded. They provide a way to configure the initial state of your
application, as well as to set up dependency injections that are local
to the application instance (e.g. A/B testing configurations).
And read more at http://emberjs.com/deprecations/instance-initializers/
For your purposes it’s better use application initializer thus it’s callback got instance of Ember.Application
( not Ember.ApplicationInstance
) so you can use http://emberjs.com/api/classes/Ember.Application.html method to register your components/services/dependencies