gd-sprest 8.0.8 → 8.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/helper/methods/loadSPCore.js +31 -27
- package/build/rest.js +1 -1
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSPCore = void 0;
|
|
4
|
+
var executor_1 = require("../executor");
|
|
4
5
|
/**
|
|
5
6
|
* Loads the core SharePoint JavaScript library for JSOM.
|
|
6
7
|
*/
|
|
@@ -8,33 +9,36 @@ exports.loadSPCore = function () {
|
|
|
8
9
|
// Return a promise
|
|
9
10
|
return new Promise(function (resolve) {
|
|
10
11
|
// Define the core libraries to load
|
|
11
|
-
var libs = ["init", "MicrosoftAjax", "SP.Runtime", "SP"];
|
|
12
|
-
var _loop_1 = function (i) {
|
|
13
|
-
var libName = libs[i];
|
|
14
|
-
// See if a script already exists
|
|
15
|
-
if (document.querySelector("script[title='" + libName + "']") == null) {
|
|
16
|
-
// Log
|
|
17
|
-
console.debug("[gd-sprest] Loading the core library: " + libName);
|
|
18
|
-
// Create the script element to load the library
|
|
19
|
-
var elScript_1 = document.createElement("script");
|
|
20
|
-
elScript_1.title = libName;
|
|
21
|
-
elScript_1.src = document.location.origin + "/_layouts/15/" + libName + ".js";
|
|
22
|
-
// Wait for the previous library to load
|
|
23
|
-
setTimeout(function () {
|
|
24
|
-
// Load the script
|
|
25
|
-
document.head.appendChild(elScript_1);
|
|
26
|
-
}, 10 * i);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// Log
|
|
30
|
-
console.debug("[gd-sprest] Core library already loaded: " + libName);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
12
|
+
var libs = ["init", "MicrosoftAjax", "SP.Runtime", "SP", "SP.Init"];
|
|
33
13
|
// Parse the libraries
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
var counter = 0;
|
|
15
|
+
executor_1.Executor(libs, function (libName) {
|
|
16
|
+
// Return a promise
|
|
17
|
+
return new Promise(function (resolve) {
|
|
18
|
+
// See if a script already exists
|
|
19
|
+
if (document.querySelector("script[title='" + libName + "']") == null) {
|
|
20
|
+
// Log
|
|
21
|
+
console.debug("[gd-sprest] Loading the core library: " + libName);
|
|
22
|
+
// Create the script element to load the library
|
|
23
|
+
var elScript_1 = document.createElement("script");
|
|
24
|
+
elScript_1.title = libName;
|
|
25
|
+
elScript_1.src = document.location.origin + "/_layouts/15/" + libName + ".js";
|
|
26
|
+
// Wait for the previous library to load
|
|
27
|
+
setTimeout(function () {
|
|
28
|
+
// Load the script
|
|
29
|
+
document.head.appendChild(elScript_1);
|
|
30
|
+
// Resolve the request
|
|
31
|
+
resolve(null);
|
|
32
|
+
}, 10 * counter++);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Log
|
|
36
|
+
console.debug("[gd-sprest] Core library already loaded: " + libName);
|
|
37
|
+
}
|
|
38
|
+
}).then(function () {
|
|
39
|
+
// Resolve the request after all the libraries have been requested
|
|
40
|
+
resolve();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
39
43
|
});
|
|
40
44
|
};
|
package/build/rest.js
CHANGED