Use client-side config files to config things
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
class Config {
|
||||
|
||||
constructor() {
|
||||
this.init();
|
||||
}
|
||||
|
||||
async init() {
|
||||
const configFileLocation = "./js/config.json";
|
||||
|
||||
@@ -11,6 +6,7 @@ class Config {
|
||||
const response = await fetch(configFileLocation);
|
||||
const configData = await response.json();
|
||||
Object.assign(this, configData);
|
||||
return this;
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
// No config file present. That's ok. It's not required.
|
||||
|
||||
Reference in New Issue
Block a user