Definition of an App
Independent
An app, by definition, is independent. But there's more to it than that. First, let's examine what independent means, in this sense. If an app is independent, it is standalone, can be found, discovered or simply initiated (say, from a bookmark or icon) and can be used without necessarily having to be contained within a larger framework.
With our UI5 apps being written in JavaScript (yes, and there are declarative parts too that don't have to be in JavaScript), we need to have at least a small structure that is native to the runtime context's features, a structure that is bookmarkable and that can facilitate the loading of the UI5 runtime and the app itself. That structure, at the bare minimum, is an HTML page.
While that HTML page serves as a delivery mechanism for the UI5 app, it should not do much more than that. As well as being independently discoverable and startable, the app itself - the UI5 parts from which it is constructed, should also be independent of the HTML page. That is to say, we should ideally be able to take the app, and the functionality it offers, and embed it into another structure, and have it live and run there just as happily.
For those of you acquainted with the standard delivery mechanism for the SAP Fiori suite of apps, this is something that may be familiar - the Launchpad, which is the HTML-based user-facing part of the Unified Shell infrastructure.
Whether you intend your app to run within such a framework or not, designing it with this feature in mind has benefits not only relating to independence and runtime frameworks, but also relating to construction across different development teams. An app, or part of an app, developed as an independent unit, lends itself more to being constructed and delivered by separate teams working on a greater whole (say, a suite of related functions).
So what does that mean for us as an app developer with UI5? It means that we should build our apps using the Component concept. Being a component means that the app can be delivered and run within a simple, standalone HTML page, or within the wider context of a Launchpad. If you construct your component correctly, this will be possible. It also means that we should reduce the content of the standalone HTML page to the bare essentials
meta tags in the document header to give the browser the best hints at rendering our app correctly
a script tag, known as the UI5 bootstrap, which loads the UI5 runtime core
an appropriately marked up HTML body into which the UI5 controls can be places
minimal UI5 logic executed when the runtime has been loaded; this logic is to create an sap.m.ComponentContainer and point to our app component which will be then automatically retrieved and loaded
UI5 apps are configurable in the bootstrap; however best practice states that bootstrap configuration (attributes that start with the prefix data-sap-ui) should be kept to a minimum. As an example, you should specify the theme, and tell the runtime where it should expect to find the resources (your component file, your views and controllers, and so on), based on the names you've used within your app. There are a number of ways that you can tell the module loading mechanism where to find things; the best way is to use the data-sap-ui-resourceroots parameter.
What should you call this standalone HTML page? You can of course use any name you want, however, exercise restraint. Common names are index.html or main.html. These names are perfectly fine; you may or may not want your web server to automatically serve up a default HTML page if the containing folder is requested. To highlight the fact that the HTML file is mainly a delivery mechanism for your app for when it's being initiated in a standalone fashion (as opposed to within the wider context of a Launchpad), another common name is localIndex.html.
Definition of an App
Independent
An app, by definition, is independent. But there's more to it than that. First, let's examine what independent means, in this sense. If an app is independent, it is standalone, can be found, discovered or simply initiated (say, from a bookmark or icon) and can be used without necessarily having to be contained within a larger framework.
With our UI5 apps being written in JavaScript (yes, and there are declarative parts too that don't have to be in JavaScript), we need to have at least a small structure that is native to the runtime context's features, a structure that is bookmarkable and that can facilitate the loading of the UI5 runtime and the app itself. That structure, at the bare minimum, is an HTML page.
While that HTML page serves as a delivery mechanism for the UI5 app, it should not do much more than that. As well as being independently discoverable and startable, the app itself - the UI5 parts from which it is constructed, should also be independent of the HTML page. That is to say, we should ideally be able to take the app, and the functionality it offers, and embed it into another structure, and have it live and run there just as happily.
For those of you acquainted with the standard delivery mechanism for the SAP Fiori suite of apps, this is something that may be familiar - the Launchpad, which is the HTML-based user-facing part of the Unified Shell infrastructure.
Whether you intend your app to run within such a framework or not, designing it with this feature in mind has benefits not only relating to independence and runtime frameworks, but also relating to construction across different development teams. An app, or part of an app, developed as an independent unit, lends itself more to being constructed and delivered by separate teams working on a greater whole (say, a suite of related functions).
So what does that mean for us as an app developer with UI5? It means that we should build our apps using the Component concept. Being a component means that the app can be delivered and run within a simple, standalone HTML page, or within the wider context of a Launchpad. If you construct your component correctly, this will be possible. It also means that we should reduce the content of the standalone HTML page to the bare essentials
meta tags in the document header to give the browser the best hints at rendering our app correctly
a script tag, known as the UI5 bootstrap, which loads the UI5 runtime core
an appropriately marked up HTML body into which the UI5 controls can be places
minimal UI5 logic executed when the runtime has been loaded; this logic is to create an sap.m.ComponentContainer and point to our app component which will be then automatically retrieved and loaded
UI5 apps are configurable in the bootstrap; however best practice states that bootstrap configuration (attributes that start with the prefix data-sap-ui) should be kept to a minimum. As an example, you should specify the theme, and tell the runtime where it should expect to find the resources (your component file, your views and controllers, and so on), based on the names you've used within your app. There are a number of ways that you can tell the module loading mechanism where to find things; the best way is to use the data-sap-ui-resourceroots parameter.
What should you call this standalone HTML page? You can of course use any name you want, however, exercise restraint. Common names are index.html or main.html. These names are perfectly fine; you may or may not want your web server to automatically serve up a default HTML page if the containing folder is requested. To highlight the fact that the HTML file is mainly a delivery mechanism for your app for when it's being initiated in a standalone fashion (as opposed to within the wider context of a Launchpad), another common name is localIndex.html.
การแปล กรุณารอสักครู่..
