Updated the load so I could reload the UI without a need of restarting the full client
This commit is contained in:
parent
41323f9a5c
commit
52d998000d
6 changed files with 10 additions and 5 deletions
|
@ -17,12 +17,15 @@ export interface Config {
|
|||
loader_groups: boolean;
|
||||
verbose: boolean;
|
||||
error: boolean;
|
||||
|
||||
baseUrl: string;
|
||||
}
|
||||
|
||||
export let config: Config = {
|
||||
loader_groups: false,
|
||||
verbose: false,
|
||||
error: true
|
||||
error: true,
|
||||
baseUrl: "./"
|
||||
};
|
||||
|
||||
export type Task = {
|
||||
|
|
|
@ -51,7 +51,7 @@ function load_script_url(url: string) : Promise<void> {
|
|||
|
||||
document.getElementById("scripts").appendChild(script_tag);
|
||||
|
||||
script_tag.src = url;
|
||||
script_tag.src = config.baseUrl + url;
|
||||
})).then(result => {
|
||||
/* cleanup memory */
|
||||
_script_promises[url] = Promise.resolve(); /* this promise does not holds the whole script tag and other memory */
|
||||
|
|
|
@ -79,7 +79,7 @@ function load_style_url(url: string) : Promise<void> {
|
|||
};
|
||||
|
||||
document.getElementById("style").appendChild(tag);
|
||||
tag.href = url;
|
||||
tag.href = config.baseUrl + url;
|
||||
})).then(result => {
|
||||
/* cleanup memory */
|
||||
_style_promises[url] = Promise.resolve(); /* this promise does not holds the whole script tag and other memory */
|
||||
|
|
|
@ -8,7 +8,7 @@ function load_template_url(url: string) : Promise<void> {
|
|||
return _template_promises[url];
|
||||
|
||||
return (_template_promises[url] = (async () => {
|
||||
const response = await $.ajax(url);
|
||||
const response = await $.ajax(config.baseUrl + url);
|
||||
|
||||
let node = document.createElement("html");
|
||||
node.innerHTML = response;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as loader from "../loader/loader";
|
||||
import {config} from "../loader/loader";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
@ -74,7 +75,7 @@ const loader_javascript = {
|
|||
|
||||
let manifest: Manifest;
|
||||
try {
|
||||
const response = await fetch("js/manifest.json");
|
||||
const response = await fetch(config.baseUrl + "js/manifest.json");
|
||||
if(!response.ok) throw response.status + " " + response.statusText;
|
||||
|
||||
manifest = await response.json();
|
||||
|
|
1
loader/exports/loader.d.ts
vendored
1
loader/exports/loader.d.ts
vendored
|
@ -2,6 +2,7 @@ export interface Config {
|
|||
loader_groups: boolean;
|
||||
verbose: boolean;
|
||||
error: boolean;
|
||||
baseUrl: string;
|
||||
}
|
||||
|
||||
export enum BackendType {
|
||||
|
|
Loading…
Add table
Reference in a new issue