In every UI5 application we declare usage on libraries like sap.ui.commons via “data-sap-ui-libs”.
Have you ever thought about how does the logic work? Since we only declare the NAME of libraries here, how, when, and where are these libraries loaded from repository when your UI5 application is launched?
Requirement
One colleague asked me how this works under the hood. He would like to know how to explore it by himself.
First attempt in Chrome
I have launched my UI5 application, I could already see the resource files for the corresponding above four declared libraries under the folder “resources”.
and observe from Network tab, our application html page is always loaded from repository first, and then the sap-ui-core.js, followed by all the other libraries.
I would assume it is sap-ui-core.js which issues the subsequent call to load the declared libraries from repository. The proof is, I could find totally 27 AJAX calls in this big file ( 18697 lines ).
The question is: how to find the place to issue library load calls in an efficient way?
Approach1: use XHR breakpoint ( as usual )
Enable XHR Breakpoint, and type your application url in Chrome and press enter key. The breakpoint will be triggered for loading ui core library. Click callstack “jQuery.sap.preloadModules”.
type “m” in Watch Expressions tab, and then you can see the url for “library-preload.json”. This AJAX call generates the very entry in Network tab in the third screenshot of this document.
Press F8 for several times and then we reach this callstack. Click k._boot:
From here I could know these five libraries will be loaded via AJAX.
These five libraries will be loaded one by one in a for loop. And currently the third loop is working on sap.viz.library.
And for this library, if your browser support SVG, it will lead to the repository call for the following files:
And again you would see the url of each file in AJAX call, and know that the AJAX is actually done in a synchronous way.
So finally I could see the following files are fetched from repository, which are corresponded to the jQuery.sap.require method call in the previous screenshot ( line 93 ~ line 105 )
Approach2: A far more efficient way
If you have known that sap-ui-core.js uses the same code to fetch your application js code and sap UI standard library, you could find the place of this call in a more efficient way. Deliberately generates a syntax error in your application view and launch the application.
And Chrome will point out the erroneous code position. Just click the hyperlink:
Then it will automatically navigate you to the line of error code. And click the pretty print button:
After pretty print format, you will see the line of code which raises the syntax error ( line 8136 ). And in line 8114, the AJAX call is just what we have found via approach1.
Although this document contains no actual development skills for UI5, it tries to demonstrate how to explore the fundamental of UI5 via Chrome by yourself. Hope it would be useful for your daily troubleshooting when developing UI5 applications.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
相关推荐
- **扩展SAP UI5**:探讨如何利用API扩展框架的功能。 - **控制组件**: - **NotePad 控件**:介绍NotePad控件的基本用法及其应用场景。 - **CVOM 图表**:CVOM图表是一种用于展示复杂数据的图表类型,在SAP UI5...
在本教程中,我们将深入探讨如何开发一个使用SAPUI5和oData访问的数据交互应用程序。SAPUI5是SAP提供的一个强大的JavaScript框架,用于构建企业级的Web应用程序。而oData是一种开放的协议,它允许客户端通过HTTP访问...
压缩包中的`sapui5_1-master`可能包含了一个简单的SAP UI5应用实例,通常会包括以下文件和目录: 1. `index.html`:应用程序的入口点,引入SAP UI5库和其他必要的资源。 2. `Component.js`:组件配置文件,定义应用...
根据给定文件的信息,我们可以详细地探讨如何使用Fiori的方式开发响应式的SAPUI5应用程序。本篇文章将深入分析SAPUI5及其与Fiori应用的关系,并着重讲解Fiori模式下的响应式设计原则。 ### SAPUI5简介 SAPUI5是一...
在本篇文章中,我们将深入探讨如何为SAPUI5中的`TextField`添加占位符功能。此技术是在SAPUI5框架默认不提供占位符功能的情况下实现的一种工作方法。 ### 添加占位符功能 #### 标题和描述概述 在SAPUI5中,默认...
ui5-CoreLoader.js是一个独立于SAPUI5和OpenUI5的JavaScript模块,其主要功能是预加载和异步加载这两个框架的核心库。通过提前加载必要的资源,它能显著减少用户首次访问应用时的等待时间,从而提升用户体验。 二、...
其中,`sap-ui-core.js`是UI5库的核心脚本文件,负责加载其他所有UI5组件。 4. SAP UI5库引用:`data-sap-ui-libs`属性用于指定应用所需的UI5库,例如`***mons`表明使用了基础控件库。`data-sap-ui-theme`属性用于...
1. **设置index.html**:在HTML文件中引入SAPUI5库,并创建一个`<div>`元素作为应用的容器。 2. **定义App.js**:创建一个UIComponent实例,然后加载主视图。 3. **创建View.js**:定义一个简单的XML视图,包含一个...
元数据文件通常以`.xml`格式提供,并由SAPUI5应用加载以了解如何与Servlet通信。 3. **创建View和Controller**:创建一个SAPUI5视图,使用控件如Table或List来显示消息概述。同时,创建一个对应的控制器,其中包含...
在"**SapUI5RoutingTut**"这个教程中,我们将深入探讨SapUI5的路由机制。路由的主要功能是将URL路径映射到特定的视图和控制器,从而实现页面间的动态导航。路由配置通常在`manifest.json`文件中定义,其中包含了各种...
在这个"UI5 navigation"主题中,我们将深入探讨UI5中的导航机制、FIOIR基本框架以及配置文件的使用。 1. **UI5导航机制** UI5提供了一种强大的导航框架,基于路由器(Router)和视图(View)的概念。路由器负责...
在SAPUI5中,数据绑定是连接应用程序界面与数据模型的重要机制,使得视图元素可以动态地显示和更新后端或本地数据。本示例" sapui5-bind-table-dropdownbox "聚焦于如何将Table控件与DropdownBox相结合,并根据表格...
UI5 Web Components是SAP公司推出的一套基于Web标准的组件库,专为构建企业级用户界面而设计。它利用了Web Components技术,允许开发者创建可重用、自包含且平台无关的用户界面元素,从而提升开发效率和应用的统一性...
3. **SAP RFC调用**:使用SAP的.NET库,需要创建一个`IRfcFunction`对象,加载SAP模块中的RFC函数,然后设置参数并执行。例如,`RfcDestinationManager.GetDestination()` 获取SAP系统的连接信息,`function = ...
在本文中,我们将深入探讨如何使用UI5中的Grid Table创建一个自定义的简易报表,以实现自由风格的数据展示。UI5(User Interface for SAP)是SAP公司提供的一款用于构建企业级Web应用程序的开放源代码JavaScript框架...
这些工具支持代码编辑、调试、预览,以及对UI5库的完整文档和示例,极大地提高了开发效率。 在《UI5综合指南》中,我们还会探讨如何进行单元测试和集成测试,以确保代码的质量和稳定性。同时,性能优化是另一个关键...
本篇文章将深入探讨"Control Toolkit中的文本处理、核心对象以及SAP数据绑定"的相关知识点。 首先,我们关注的是"Control Toolkit中的文本处理"。AJAX Control Toolkit包含了一系列用于处理用户输入文本的控件,如...
5. 动态加载和懒加载:探讨了如何优化性能,通过只在需要时加载节点来提高应用响应速度。 6. 样式和自定义:可能包含了如何改变Tree Control的视觉外观,以及实现自定义行为的技巧。 第10章:实战Smart Forms设计 ...
RTCRcrm52的UI开发充分利用SAPUI5的组件库,提供丰富的控件和数据绑定机制,以及强大的模型视图控制器(MVC)架构。 2. OData服务:基于RESTful的接口,用于在客户端和服务器之间交换数据。SAP CRM Web客户端利用...
本文通过几个具体的案例,深入探讨了如何在SAP CRM环境中进行程序优化,特别是针对WebUI界面的优化方法。 #### 二、WebUI页面状态优化 在SAP CRM中,WebUI页面通常分为显示状态和编辑状态。显示状态用于展示数据...