Start of a web UI config
This commit is contained in:
21
webroot/js/config.js
Normal file
21
webroot/js/config.js
Normal file
@@ -0,0 +1,21 @@
|
||||
class Config {
|
||||
|
||||
constructor() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
async init() {
|
||||
const configFileLocation = "js/config.json";
|
||||
|
||||
try {
|
||||
const response = await fetch(configFileLocation);
|
||||
const configData = await response.json();
|
||||
Object.assign(this, configData);
|
||||
console.log(this);
|
||||
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
// No config file present. That's ok. It's not required.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user