SAP UI5加载时的library-preload.json文件
library-preload.json文件的作用,在Jerry的博客How I do self-study on a given Fiori control – part 1里有介紹:
In productive use, for performance reasons, all controls of a library are also available in the library-preload.json file, which is loaded initially (and can be loaded asynchronously). It contains each control/module as a string, which is then parsed into JavaScript on demand. So this avoids many HTTP requests and thus improves performance.
以上文字來自SAP UI5開發人員:Kunz Andreas:
我試著簡單翻譯一下:
在productive使用場景下,處于性能考慮,一個SAP UI5應用的單個library里包含的所有控件實現會被打包成單個的文件library-preload.json中去,可以在SAP UI5應用bootstrap階段加載或者按需進行異步加載。Library-preload.json以字符串的格式包含了每個control/module的實現,可以被解析成JavaScript對象在SAP UI5框架里使用。這種打包成單個庫文件然后加載的方式,減少了HTTP請求的數量,提高了性能。
上圖是按照Jerry文章一個用于SAP UI5學習的腳手架應用,沒有任何后臺API的依賴里介紹的方法,開發了一個只包含button控件的最簡單的SAP UI5應用,加載之后在Chrome開發者工具里觀察到的網絡請求,其中包含四個library-preload.js的加載:
- https://openui5.hana.ondemand.com/resources/sap/ui/core/library-preload.js
- https://openui5.hana.ondemand.com/resources/sap/ui/commons/library-preload.js
- https://openui5.hana.ondemand.com/resources/sap/ui/layout/library-preload.js
- https://openui5.hana.ondemand.com/resources/sap/ui/unified/library-preload.js
更多Jerry的原創文章,盡在:“汪子熙”:
總結
以上是生活随笔為你收集整理的SAP UI5加载时的library-preload.json文件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《刺客信条:大革命》DLC苏杰之鹰解锁技
- 下一篇: SAP Spartacus org un