- sap-ui-loaddbg
- dbg
- -dbg
- async
- false
- execModule
将所有的.替换成/:
将之前用jQuery.sap.declare添加到mModules map里的entry取出:
根据debug mode的状态选择load哪个版本的js 文件:
require是用同步方式取resource:
line 16231会跳转到line 16241:
load成功后立刻执行module:
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/5f2f6485e59c45d68e95549a192baf47.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)
UI5里使用jQuery.sap.require 同步加载module:
首先判断传入的参数是否是array或者function:
将module name转换成url:
将.替换成/:
转换之后的结果:
line 8392 利用原生的exec试探传入的s是否为一个js文件:
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/fcbbe8f8e1994be1a8729df4c2e4a7b8.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/b15f9776834d4d949e8eabba1d711c6d.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/c1dea2cb0f254c0298cbd0cea20c0bec.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/d81e9f07fde94f2ea4a11d5764610096.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/52d7dc0fb68f4ca8a98d76bf92db5b41.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)
最后通过AJAX获得结果:
![jQuery.sap.require jQuery.sap.require](https://ctyun-collect-0531.gdoss.xstore.ctyun.cn/files/2022/09/28/07cb44496fc046d080f20fa3829456f4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_30,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=/resize,m_fixed,w_750)