1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | (function() {
|
14 |
|
15 | "use strict";
|
16 |
|
17 |
|
18 | var oScriptTag, mMatch, sBaseUrl;
|
19 |
|
20 | oScriptTag = document.getElementById("sap-ui-bootstrap");
|
21 | if (oScriptTag) {
|
22 | mMatch = /^(?:.*\/)?resources\//.exec(oScriptTag.getAttribute("src"));
|
23 | if (mMatch) {
|
24 | sBaseUrl = mMatch[0];
|
25 | }
|
26 | }
|
27 |
|
28 | if (sBaseUrl == null) {
|
29 | throw new Error("sap-ui-boot.js: could not identify script tag!");
|
30 | }
|
31 |
|
32 | function loadScripts(urls, callback) {
|
33 | var pending = urls.length,
|
34 | errors = 0;
|
35 |
|
36 | if (pending === 0) {
|
37 | callback();
|
38 | return;
|
39 | }
|
40 |
|
41 | function listener(e) {
|
42 | pending--;
|
43 | if ( e.type === 'error' ) {
|
44 | errors++;
|
45 | }
|
46 | e.target.removeEventListener("load", listener);
|
47 | e.target.removeEventListener("error", listener);
|
48 | if ( pending === 0 && errors === 0 && callback ) {
|
49 | callback();
|
50 | }
|
51 | }
|
52 |
|
53 | for ( var i = 0; i < urls.length; i++ ) {
|
54 | var script = document.createElement("script");
|
55 | script.addEventListener("load", listener);
|
56 | script.addEventListener("error", listener);
|
57 | script.src = sBaseUrl + urls[i];
|
58 | document.head.appendChild(script);
|
59 | }
|
60 | }
|
61 |
|
62 |
|
63 | loadScripts([
|
64 | "ui5loader.js"
|
65 | ], function() {
|
66 |
|
67 | sap.ui.loader.config({
|
68 | async:true
|
69 | });
|
70 | loadScripts([
|
71 | "ui5loader-autoconfig.js"
|
72 | ]);
|
73 | });
|
74 |
|
75 | }());
|