2020-06-15 00:18:43 +02:00
|
|
|
class Config {
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
async init() {
|
2020-06-16 00:45:55 +02:00
|
|
|
const configFileLocation = "./js/config.json";
|
2020-06-15 00:18:43 +02:00
|
|
|
|
|
|
|
try {
|
|
|
|
const response = await fetch(configFileLocation);
|
|
|
|
const configData = await response.json();
|
|
|
|
Object.assign(this, configData);
|
|
|
|
} catch(error) {
|
|
|
|
console.log(error);
|
|
|
|
// No config file present. That's ok. It's not required.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|