mirror of
https://github.com/overte-org/overte.git
synced 2025-07-24 00:24:00 +02:00
Better logic in bootstrapper to not load alread running scripts
This commit is contained in:
parent
85b563461a
commit
712d608c15
1 changed files with 33 additions and 5 deletions
|
@ -12,15 +12,30 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
var currentlyRunningScripts = ScriptDiscoveryService.getRunning();
|
||||||
|
|
||||||
|
|
||||||
var DEFAULT_SCRIPTS_SEPARATE = [
|
var DEFAULT_SCRIPTS_SEPARATE = [
|
||||||
"system/controllers/controllerScripts.js",
|
"system/controllers/controllerScripts.js",
|
||||||
"simplifiedUI/ui/simplifiedUI.js"
|
"simplifiedUI/ui/simplifiedUI.js"
|
||||||
];
|
];
|
||||||
function loadSeparateDefaults() {
|
function loadSeparateDefaults() {
|
||||||
for (var i in DEFAULT_SCRIPTS_SEPARATE) {
|
for (var i = 0; i < DEFAULT_SCRIPTS_SEPARATE.length; i++) {
|
||||||
|
var shouldLoadCurrentDefaultScript = true;
|
||||||
|
|
||||||
|
for (var j = 0; j < currentlyRunningScripts.length; j++) {
|
||||||
|
var currentRunningScriptObject = currentlyRunningScripts[j];
|
||||||
|
var currentDefaultScriptName = DEFAULT_SCRIPTS_SEPARATE[i].substr((DEFAULT_SCRIPTS_SEPARATE[i].lastIndexOf("/") + 1), DEFAULT_SCRIPTS_SEPARATE[i].length);
|
||||||
|
if (currentDefaultScriptName === currentRunningScriptObject.name) {
|
||||||
|
shouldLoadCurrentDefaultScript = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldLoadCurrentDefaultScript) {
|
||||||
Script.load(DEFAULT_SCRIPTS_SEPARATE[i]);
|
Script.load(DEFAULT_SCRIPTS_SEPARATE[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var DEFAULT_SCRIPTS_COMBINED = [
|
var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
|
@ -29,11 +44,24 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/away.js"
|
"system/away.js"
|
||||||
];
|
];
|
||||||
function runDefaultsTogether() {
|
function runDefaultsTogether() {
|
||||||
for (var i in DEFAULT_SCRIPTS_COMBINED) {
|
for (var i = 0; i < DEFAULT_SCRIPTS_COMBINED.length; i++) {
|
||||||
|
var shouldIncludeCurrentDefaultScript = true;
|
||||||
|
|
||||||
|
for (var j = 0; j < currentlyRunningScripts.length; j++) {
|
||||||
|
var currentRunningScriptObject = currentlyRunningScripts[j];
|
||||||
|
var currentDefaultScriptName = DEFAULT_SCRIPTS_COMBINED[i].substr((DEFAULT_SCRIPTS_COMBINED[i].lastIndexOf("/") + 1), DEFAULT_SCRIPTS_COMBINED[i].length);
|
||||||
|
if (currentDefaultScriptName === currentRunningScriptObject.name) {
|
||||||
|
shouldIncludeCurrentDefaultScript = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldIncludeCurrentDefaultScript) {
|
||||||
Script.include(DEFAULT_SCRIPTS_COMBINED[i]);
|
Script.include(DEFAULT_SCRIPTS_COMBINED[i]);
|
||||||
}
|
}
|
||||||
loadSeparateDefaults();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
runDefaultsTogether();
|
runDefaultsTogether();
|
||||||
|
loadSeparateDefaults();
|
||||||
|
|
Loading…
Reference in a new issue