SAP UI5 - Modularization



In SAPUI5 development for larger JavaScript applications, UI5 framework provides built in support for modularization. Modularization concept allows you to split application into smaller parts and they can be combined together at run time. These smaller application parts are called modularization.

You can declare your own JavaScript module by calling the query jQuery.sap.declare function and this is used to keep track of the module name and already loaded module.

To load a module, you have to use jQuery.sap.require

Example

<script>
   jQuery.sap.require(“sap.ui.commons.MessageBox”);
   ………………………
</script>

When a module is required jQuery.sap.require and that module is not loaded, it automatically loads. It calls the declare method so when require is called it knows that the module has been loaded.

Advertisements