blob: b54b1c15912b75c7be8bce73e3c83662e20e0aaa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
//So features can add settings by adding to this class, then the gui will load data from this class
//this makes it so i can add settings before the settings gui is loaded
//and so that settings gui can still be dynamicly reloaded and not break things
class SettingsCommunicator {
constructor(){
this.settings = {}
}
addSetting(module, settingID, settingObject){
if(!this.settings[module]) this.settings[module] = {}
this.settings[module][settingID] = settingObject
}
removeSetting(module, settingID){
if(!this.settings[module]) return;
delete this.settings[module][settingID]
}
getSetting(module, settingID){
return this.settings[module][settingID]
}
getModuleSettings(module){
return Object.values(this.settings[module] || [])
}
}
const settingsCommunicator = new SettingsCommunicator()
export default settingsCommunicator
|