commit
9c43118f2f
5 changed files with 6498 additions and 6487 deletions
|
@ -296,6 +296,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_directories(&$error, $path, $dry_run = false) {
|
function delete_directories(&$error, $path, $dry_run = false) {
|
||||||
|
if(!file_exists($path))
|
||||||
|
return true;
|
||||||
|
|
||||||
if(strpos(PHP_OS, "Linux") !== false) {
|
if(strpos(PHP_OS, "Linux") !== false) {
|
||||||
$command = "rm -r " . $path;
|
$command = "rm -r " . $path;
|
||||||
} else if(strpos(PHP_OS, "WINNT") !== false) {
|
} else if(strpos(PHP_OS, "WINNT") !== false) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ if [[ "$#" -ne 3 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d client&&pi/environment/ui-files/ ]]; then
|
if [[ ! -d client/environment/ui-files/ ]]; then
|
||||||
echo "Missing UI Files"
|
echo "Missing UI Files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -54,7 +54,7 @@ namespace loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
export let cache_tag: string | undefined;
|
export let cache_tag: string | undefined;
|
||||||
let current_stage: Stage = Stage.INITIALIZING;
|
let current_stage: Stage = undefined;
|
||||||
const tasks: {[key:number]:Task[]} = {};
|
const tasks: {[key:number]:Task[]} = {};
|
||||||
|
|
||||||
export function finished() {
|
export function finished() {
|
||||||
|
@ -82,7 +82,7 @@ namespace loader {
|
||||||
|
|
||||||
let begin: number = Date.now();
|
let begin: number = Date.now();
|
||||||
let end: number;
|
let end: number;
|
||||||
while(current_stage <= Stage.LOADED) {
|
while(current_stage <= Stage.LOADED || typeof(current_stage) === "undefined") {
|
||||||
|
|
||||||
let current_tasks: Task[] = [];
|
let current_tasks: Task[] = [];
|
||||||
while((tasks[current_stage] || []).length > 0) {
|
while((tasks[current_stage] || []).length > 0) {
|
||||||
|
@ -98,40 +98,51 @@ namespace loader {
|
||||||
|
|
||||||
const promises: Promise<void>[] = [];
|
const promises: Promise<void>[] = [];
|
||||||
for(const task of current_tasks) {
|
for(const task of current_tasks) {
|
||||||
try {
|
try {
|
||||||
console.debug("Executing loader %s (%d)", task.name, task.priority);
|
console.debug("Executing loader %s (%d)", task.name, task.priority);
|
||||||
promises.push(task.function().catch(error => {
|
promises.push(task.function().catch(error => {
|
||||||
errors.push({
|
errors.push({
|
||||||
task: task,
|
task: task,
|
||||||
error: error
|
error: error
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}));
|
}));
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
errors.push({
|
errors.push({
|
||||||
task: task,
|
task: task,
|
||||||
error: error
|
error: error
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all([...promises]);
|
await Promise.all([...promises]);
|
||||||
|
|
||||||
if(errors.length > 0) {
|
if(errors.length > 0) {
|
||||||
console.error("Failed to execute loader. The following tasks failed (%d):", errors.length);
|
console.groupEnd();
|
||||||
for(const error of errors)
|
console.error("Failed to execute loader. The following tasks failed (%d):", errors.length);
|
||||||
console.error(" - %s: %o", error.task.name, error.error);
|
for(const error of errors)
|
||||||
|
console.error(" - %s: %o", error.task.name, error.error);
|
||||||
|
|
||||||
throw "failed to process step " + Stage[current_stage];
|
throw "failed to process step " + Stage[current_stage];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(current_tasks.length == 0) {
|
if(current_tasks.length == 0) {
|
||||||
if(current_stage < Stage.LOADED)
|
if(typeof(current_stage) === "undefined") {
|
||||||
console.debug("[loader] entering next state (%s). Last state took %dms", Stage[current_stage + 1], (end = Date.now()) - begin);
|
current_stage = -1;
|
||||||
else
|
console.debug("[loader] Booting app");
|
||||||
|
} else if(current_stage < Stage.INITIALIZING) {
|
||||||
|
console.groupEnd();
|
||||||
|
console.debug("[loader] Entering next state (%s). Last state took %dms", Stage[current_stage + 1], (end = Date.now()) - begin);
|
||||||
|
} else {
|
||||||
|
console.groupEnd();
|
||||||
console.debug("[loader] Finish invoke took %dms", (end = Date.now()) - begin);
|
console.debug("[loader] Finish invoke took %dms", (end = Date.now()) - begin);
|
||||||
|
}
|
||||||
|
|
||||||
begin = end;
|
begin = end;
|
||||||
current_stage += 1;
|
current_stage += 1;
|
||||||
|
|
||||||
|
if(current_stage != Stage.DONE)
|
||||||
|
console.groupCollapsed("Executing loading stage %s", Stage[current_stage]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.debug("[loader] finished loader. (Total time: %dms)", Date.now() - load_begin);
|
console.debug("[loader] finished loader. (Total time: %dms)", Date.now() - load_begin);
|
||||||
|
@ -977,6 +988,7 @@ try { /* lets try to print it as VM code :)*/
|
||||||
let hello_world_code = hello_world.toString();
|
let hello_world_code = hello_world.toString();
|
||||||
hello_world_code = hello_world_code.substr(hello_world_code.indexOf('() => {') + 8);
|
hello_world_code = hello_world_code.substr(hello_world_code.indexOf('() => {') + 8);
|
||||||
hello_world_code = hello_world_code.substring(0, hello_world_code.lastIndexOf("}"));
|
hello_world_code = hello_world_code.substring(0, hello_world_code.lastIndexOf("}"));
|
||||||
|
hello_world_code = hello_world_code.replace(/(?!"\S*) {2,}(?!\S*")/g, " ").replace(/[\n\r]/g, "");
|
||||||
eval(hello_world_code);
|
eval(hello_world_code);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
hello_world();
|
hello_world();
|
||||||
|
|
|
@ -4,7 +4,7 @@ const WASM_ERROR_MESSAGES = [
|
||||||
'no native wasm support detected'
|
'no native wasm support detected'
|
||||||
];
|
];
|
||||||
|
|
||||||
this["Module"] = this["Module"] || {};
|
this["Module"] = this["Module"] || ({} as any); /* its required to cast {} to any!*/
|
||||||
|
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
Module['onRuntimeInitialized'] = function() {
|
Module['onRuntimeInitialized'] = function() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue