commit
9c43118f2f
|
@ -296,6 +296,9 @@
|
|||
}
|
||||
|
||||
function delete_directories(&$error, $path, $dry_run = false) {
|
||||
if(!file_exists($path))
|
||||
return true;
|
||||
|
||||
if(strpos(PHP_OS, "Linux") !== false) {
|
||||
$command = "rm -r " . $path;
|
||||
} else if(strpos(PHP_OS, "WINNT") !== false) {
|
||||
|
|
|
@ -13,7 +13,7 @@ if [[ "$#" -ne 3 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d client&&pi/environment/ui-files/ ]]; then
|
||||
if [[ ! -d client/environment/ui-files/ ]]; then
|
||||
echo "Missing UI Files"
|
||||
exit 1
|
||||
fi
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -54,7 +54,7 @@ namespace loader {
|
|||
}
|
||||
|
||||
export let cache_tag: string | undefined;
|
||||
let current_stage: Stage = Stage.INITIALIZING;
|
||||
let current_stage: Stage = undefined;
|
||||
const tasks: {[key:number]:Task[]} = {};
|
||||
|
||||
export function finished() {
|
||||
|
@ -82,7 +82,7 @@ namespace loader {
|
|||
|
||||
let begin: number = Date.now();
|
||||
let end: number;
|
||||
while(current_stage <= Stage.LOADED) {
|
||||
while(current_stage <= Stage.LOADED || typeof(current_stage) === "undefined") {
|
||||
|
||||
let current_tasks: Task[] = [];
|
||||
while((tasks[current_stage] || []).length > 0) {
|
||||
|
@ -98,40 +98,51 @@ namespace loader {
|
|||
|
||||
const promises: Promise<void>[] = [];
|
||||
for(const task of current_tasks) {
|
||||
try {
|
||||
console.debug("Executing loader %s (%d)", task.name, task.priority);
|
||||
promises.push(task.function().catch(error => {
|
||||
errors.push({
|
||||
task: task,
|
||||
error: error
|
||||
});
|
||||
return Promise.resolve();
|
||||
}));
|
||||
} catch(error) {
|
||||
errors.push({
|
||||
task: task,
|
||||
error: error
|
||||
});
|
||||
}
|
||||
try {
|
||||
console.debug("Executing loader %s (%d)", task.name, task.priority);
|
||||
promises.push(task.function().catch(error => {
|
||||
errors.push({
|
||||
task: task,
|
||||
error: error
|
||||
});
|
||||
return Promise.resolve();
|
||||
}));
|
||||
} catch(error) {
|
||||
errors.push({
|
||||
task: task,
|
||||
error: error
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all([...promises]);
|
||||
|
||||
if(errors.length > 0) {
|
||||
console.error("Failed to execute loader. The following tasks failed (%d):", errors.length);
|
||||
for(const error of errors)
|
||||
console.error(" - %s: %o", error.task.name, error.error);
|
||||
console.groupEnd();
|
||||
console.error("Failed to execute loader. The following tasks failed (%d):", errors.length);
|
||||
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_stage < Stage.LOADED)
|
||||
console.debug("[loader] entering next state (%s). Last state took %dms", Stage[current_stage + 1], (end = Date.now()) - begin);
|
||||
else
|
||||
if(typeof(current_stage) === "undefined") {
|
||||
current_stage = -1;
|
||||
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);
|
||||
}
|
||||
|
||||
begin = end;
|
||||
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);
|
||||
|
@ -977,6 +988,7 @@ try { /* lets try to print it as VM code :)*/
|
|||
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.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);
|
||||
} catch(e) {
|
||||
hello_world();
|
||||
|
|
|
@ -4,7 +4,7 @@ const WASM_ERROR_MESSAGES = [
|
|||
'no native wasm support detected'
|
||||
];
|
||||
|
||||
this["Module"] = this["Module"] || {};
|
||||
this["Module"] = this["Module"] || ({} as any); /* its required to cast {} to any!*/
|
||||
|
||||
let initialized = false;
|
||||
Module['onRuntimeInitialized'] = function() {
|
||||
|
|
Loading…
Reference in New Issue