2021-09-22 23:56:45 +03:00
|
|
|
module.exports = class CustomThemeSettingsCache {
|
|
|
|
constructor() {
|
|
|
|
this.content = new Object();
|
|
|
|
}
|
|
|
|
|
|
|
|
get(key) {
|
|
|
|
return this.content[key].value;
|
|
|
|
}
|
|
|
|
|
|
|
|
getAll() {
|
|
|
|
return this.content;
|
|
|
|
}
|
|
|
|
|
2021-09-23 11:16:59 +03:00
|
|
|
populate(settings) {
|
2021-09-28 17:46:32 +03:00
|
|
|
this.clear();
|
|
|
|
|
2021-09-23 11:16:59 +03:00
|
|
|
settings.forEach((setting) => {
|
2021-09-22 23:56:45 +03:00
|
|
|
this.content[setting.key] = setting.value;
|
|
|
|
});
|
|
|
|
}
|
2021-09-28 17:46:32 +03:00
|
|
|
|
|
|
|
clear() {
|
|
|
|
for (const key in this.content) {
|
|
|
|
delete this.content[key];
|
|
|
|
}
|
|
|
|
}
|
2021-09-22 23:56:45 +03:00
|
|
|
};
|