ujs/src/js/settings.js

25 lines
537 B
JavaScript
Raw Normal View History

2023-02-16 00:04:40 +03:00
export class Settings {
static #props = {};
static get(property) {
return this.#props[property];
}
static add(property, value) {
if (!Object.getOwnPropertyDescriptors(this)[property]) {
Object.defineProperty(this, property, {
configurable: true,
enumerable: true,
get: () => this.#props[property],
set: (setValue) => { this.#props[property] = setValue; },
});
}
this.#props[property] = value;
}
static remove(property) {
delete this.#props[property];
}
}