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