forked from ecraft2learn/ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload-script.js
More file actions
23 lines (23 loc) · 833 Bytes
/
load-script.js
File metadata and controls
23 lines (23 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (!url) {
url = "https://ecraft2learn.github.io/ai/ecraft2learn.js";
}
if (!reload && window.ecraft2larn_scripts_loaded && window.ecraft2learn_scripts_loaded.indexOf(url) >= 0) {
if (typeof callback === 'object') {
invoke(callback, new List([]));
};
} else {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = url;
script.addEventListener('load', function () {
if (typeof callback === 'object') {
invoke(callback, new List([]));
};
if (window.ecraft2learn_scripts_loaded && window.ecraft2learn_scripts_loaded.indexOf(url) < 0) {
window.ecraft2learn_scripts_loaded.push(url);
} else {
window.ecraft2learn_scripts_loaded = [url];
}
});
document.head.appendChild(script);
}