UI5 Control lazy load mechanism

49 阅读1分钟
  • Create dummy constructor which loads the class on demand
  • this is a derived ( generated ) file. Change should be done in the underlying source files only(*.control, *.js) or they will be lost after the next generation.

当UI需要实例化一个js 类的instance时,

首先会call jQuery.sap.require方法去加载该类:

requireModule方法输入的是该类对应的js文件的相对路径:

sScript内容如下: 触发对应的TileBase module的加载: 通过getResourcePath获得module对应的js文件路径,然后通过AJAX想server发起请求进行加载:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":