2021-09-22 23:56:45 +03:00
|
|
|
module.exports = class CustomThemeSettingsCache {
|
|
|
|
constructor() {
|
2021-10-06 15:12:26 +03:00
|
|
|
this._content = new Object();
|
2021-09-22 23:56:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
get(key) {
|
2021-10-06 15:12:26 +03:00
|
|
|
return this._content[key];
|
2021-09-22 23:56:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
getAll() {
|
2021-10-06 15:12:26 +03:00
|
|
|
return Object.assign({}, this._content);
|
2021-09-22 23:56:45 +03:00
|
|
|
}
|
|
|
|
|
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-10-06 15:12:26 +03:00
|
|
|
this._content[setting.key] = setting.value;
|
2021-09-22 23:56:45 +03:00
|
|
|
});
|
|
|
|
}
|
2021-09-28 17:46:32 +03:00
|
|
|
|
|
|
|
clear() {
|
2021-10-06 15:12:26 +03:00
|
|
|
for (const key in this._content) {
|
|
|
|
delete this._content[key];
|
2021-09-28 17:46:32 +03:00
|
|
|
}
|
|
|
|
}
|
2021-09-22 23:56:45 +03:00
|
|
|
};
|