Applications and Instances

Applications and Instances

Every Ember application is represented by a class that extends Ember.Application. This class is used to declare and configure the many objects that make up your app.

As your application boots, it creates an Ember.ApplicationInstance that is used to manage its stateful aspects. This instance acts as the "owner" of objects instantiated for your app.

Essentially, the Application defines your application while the ApplicationInstance manages its state.

This separation of concerns not only clarifies the architecture of your app, it can also improve its efficiency. This is particularly true when your app needs to be booted repeatedly during testing and / or server-rendering (e.g. via FastBoot). The configuration of a single Application can be done once and shared among multiple stateful ApplicationInstance instances. These instances can be discarded once they're no longer needed (e.g. when a test has run or FastBoot request has finished).

© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://guides.emberjs.com/v2.13.0/applications/applications-and-instances

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部