从丁哥那里学到的两个UI5技巧

                /**
                * Determine whether to use debug sources depending on URL parameter and local storage
                * and load debug library if necessary
                */
```JavaScript
                (function() {
                                //Check URI param
                                var bDebugSources = /sap-ui-debug=(true|x|X)/.test(location.search),
                                                bIsOptimized = window["sap-ui-optimized"];
 
                                //Check local storage
                                try { //Necessary for FF when Cookies are deactivated
                                                bDebugSources = bDebugSources || (window.localStorage.getItem("sap-ui-debug") == "X");
                                } catch (e) {}
 
                                window["sap-ui-debug"] = bDebugSources;
 
                                // if bootstap URL already contains -dbg URL, just set sap-ui-loaddbg
                                if (/-dbg\.js([?#]|$)/.test(_oBootstrap.url)) {
                                                window["sap-ui-loaddbg"] = true;
                                                window["sap-ui-debug"] = true;
                                }
 
                                // if current sources are optimized and debug sources are wanted, restart with debug URL
                                if (bIsOptimized && bDebugSources) {
                                                var sDebugUrl = _oBootstrap.url.replace(/\/(?:sap-ui-cachebuster\/)?([^\/]+)\.js/, "/$1-dbg.js");
                                                window["sap-ui-optimized"] = false;
                                                window["sap-ui-loaddbg"] = true;
                                                document.write("<script type=\"text/javascript\" src=\"" + sDebugUrl + "\"></script>");
                                                var oRestart = new Error("Aborting UI5 bootstrap and restarting from: " + sDebugUrl);
                                                oRestart.name = "Restart";
                                                throw oRestart;
                                }
                })();

Sap-ui-core.js is merged from sapui5.runtime\src\framework_core\target\classes\META-INF\maven\com.sap.openui5\sap.ui.core\pom.xml

<echo>Merging module: sap-ui-core.js</echo>
                concat destfile="${project.build.outputDirectory}/META-INF/resources/sap-ui-core.js" overwrite="true" encoding="UTF-8" eol="lf" fixlastline="true">
                                                                                                                                                <filelist dir="${project.build.outputDirectory}/META-INF/resources/">
                                                                                                                                                                <file name="sap/ui/thirdparty/jquery/jquery-1.11.1.js"/>
                                                                                                                                                                <file name="sap/ui/thirdparty/jqueryui/jquery-ui-position.js"/>
                                                                                                                                                                <file name="sap/ui/Device.js"/>
                                                                                                                                                                <file name="sap/ui/thirdparty/URI.js"/>
                                                                                                                                                                <file name="jquery.sap.promise.js"/>
                                                                                                                                                                <file name="jquery.sap.global.js"/>
                                                                                                                                                </filelist>
                                                                                                                                </concat>
                                                                        
上一篇:SAP UI5应用的sap-ui-core.js被加载之前,还有哪些js文件被加载了


下一篇:SAP UI5 footerbar按钮高亮实现逻辑